You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

null.go 6.6 kB

3 years ago
Change target branch for pull request (#6488) * Adds functionality to change target branch of created pull requests Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use const instead of var in JavaScript additions Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Check if branches are equal and if PR already exists before changing target branch Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Make sure to check all commits Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Print error messages for user as error flash message Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Disallow changing target branch of closed or merged pull requests Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Resolve conflicts after merge of upstream/master Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Change order of branch select fields Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes duplicate check Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use ctx.Tr for translations Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Recompile JS Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use correct translation namespace Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Remove redundant if condition Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves most change branch logic into pull service Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Completes comment Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Add Ref to ChangesPayload for logging changed target branches instead of creating a new struct Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Revert changes to go.mod Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Directly use createComment method Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return 404 if pull request is not found. Move written check up Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Remove variable declaration Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return client errors on change pull request target errors Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return error in commit.HasPreviousCommit Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds blank line Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Test patch before persisting new target branch Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update patch before testing (not working) Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes patch calls when changeing pull request target Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes unneeded check for base name Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves ChangeTargetBranch completely to pull service. Update patch status. Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Set webhook mode after errors were validated Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update PR in one transaction Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Move logic for check if head is equal with branch to pull model Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds missing comment and simplify return Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adjust CreateComment method call Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
5 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package base
  5. import (
  6. "code.gitea.io/gitea/models"
  7. "code.gitea.io/gitea/modules/auth"
  8. "code.gitea.io/gitea/modules/repository"
  9. )
  10. // NullNotifier implements a blank notifier
  11. type NullNotifier struct {
  12. }
  13. var (
  14. _ Notifier = &NullNotifier{}
  15. )
  16. // Run places a place holder function
  17. func (*NullNotifier) Run() {
  18. }
  19. // NotifyCreateIssueComment places a place holder function
  20. func (*NullNotifier) NotifyCreateIssueComment(doer *models.User, repo *models.Repository,
  21. issue *models.Issue, comment *models.Comment) {
  22. }
  23. // NotifyNewIssue places a place holder function
  24. func (*NullNotifier) NotifyNewIssue(issue *models.Issue) {
  25. }
  26. // NotifyIssueChangeStatus places a place holder function
  27. func (*NullNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
  28. }
  29. // NotifyNewPullRequest places a place holder function
  30. func (*NullNotifier) NotifyNewPullRequest(pr *models.PullRequest) {
  31. }
  32. // NotifyPullRequestReview places a place holder function
  33. func (*NullNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, comment *models.Comment) {
  34. }
  35. // NotifyMergePullRequest places a place holder function
  36. func (*NullNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
  37. }
  38. // NotifyPullRequestSynchronized places a place holder function
  39. func (*NullNotifier) NotifyPullRequestSynchronized(doer *models.User, pr *models.PullRequest) {
  40. }
  41. // NotifyPullRequestChangeTargetBranch places a place holder function
  42. func (*NullNotifier) NotifyPullRequestChangeTargetBranch(doer *models.User, pr *models.PullRequest, oldBranch string) {
  43. }
  44. // NotifyUpdateComment places a place holder function
  45. func (*NullNotifier) NotifyUpdateComment(doer *models.User, c *models.Comment, oldContent string) {
  46. }
  47. // NotifyDeleteComment places a place holder function
  48. func (*NullNotifier) NotifyDeleteComment(doer *models.User, c *models.Comment) {
  49. }
  50. // NotifyNewRelease places a place holder function
  51. func (*NullNotifier) NotifyNewRelease(rel *models.Release) {
  52. }
  53. // NotifyUpdateRelease places a place holder function
  54. func (*NullNotifier) NotifyUpdateRelease(doer *models.User, rel *models.Release) {
  55. }
  56. // NotifyDeleteRelease places a place holder function
  57. func (*NullNotifier) NotifyDeleteRelease(doer *models.User, rel *models.Release) {
  58. }
  59. // NotifyIssueChangeMilestone places a place holder function
  60. func (*NullNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *models.Issue, oldMilestoneID int64) {
  61. }
  62. // NotifyIssueChangeContent places a place holder function
  63. func (*NullNotifier) NotifyIssueChangeContent(doer *models.User, issue *models.Issue, oldContent string) {
  64. }
  65. // NotifyIssueChangeAssignee places a place holder function
  66. func (*NullNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) {
  67. }
  68. // NotifyPullReviewRequest places a place holder function
  69. func (*NullNotifier) NotifyPullReviewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) {
  70. }
  71. // NotifyIssueClearLabels places a place holder function
  72. func (*NullNotifier) NotifyIssueClearLabels(doer *models.User, issue *models.Issue) {
  73. }
  74. // NotifyIssueChangeTitle places a place holder function
  75. func (*NullNotifier) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) {
  76. }
  77. // NotifyIssueChangeLabels places a place holder function
  78. func (*NullNotifier) NotifyIssueChangeLabels(doer *models.User, issue *models.Issue,
  79. addedLabels []*models.Label, removedLabels []*models.Label) {
  80. }
  81. // NotifyCreateRepository places a place holder function
  82. func (*NullNotifier) NotifyCreateRepository(doer *models.User, u *models.User, repo *models.Repository) {
  83. }
  84. // NotifyDeleteRepository places a place holder function
  85. func (*NullNotifier) NotifyDeleteRepository(doer *models.User, repo *models.Repository) {
  86. }
  87. // NotifyForkRepository places a place holder function
  88. func (*NullNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo *models.Repository) {
  89. }
  90. // NotifyMigrateRepository places a place holder function
  91. func (*NullNotifier) NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository) {
  92. }
  93. // NotifyPushCommits notifies commits pushed to notifiers
  94. func (*NullNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) {
  95. }
  96. // NotifyCreateRef notifies branch or tag creation to notifiers
  97. func (*NullNotifier) NotifyCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
  98. }
  99. // NotifyDeleteRef notifies branch or tag deleteion to notifiers
  100. func (*NullNotifier) NotifyDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
  101. }
  102. // NotifyRenameRepository places a place holder function
  103. func (*NullNotifier) NotifyRenameRepository(doer *models.User, repo *models.Repository, oldRepoName string) {
  104. }
  105. func (a *NullNotifier) NotifyAliasRepository(doer *models.User, repo *models.Repository, oldAlias string) {
  106. }
  107. // NotifyTransferRepository places a place holder function
  108. func (*NullNotifier) NotifyTransferRepository(doer *models.User, repo *models.Repository, oldOwnerName string) {
  109. }
  110. // NotifySyncPushCommits places a place holder function
  111. func (*NullNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) {
  112. }
  113. // NotifySyncCreateRef places a place holder function
  114. func (*NullNotifier) NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
  115. }
  116. // NotifySyncDeleteRef places a place holder function
  117. func (*NullNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
  118. }
  119. func (*NullNotifier) NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) {
  120. }
  121. func (*NullNotifier) NotifyWechatBind(user *models.User, wechatOpenId string) {
  122. }
  123. func (*NullNotifier) NotifyDatasetRecommend(optUser *models.User, dataset *models.Dataset, action string) {
  124. }
  125. func (*NullNotifier) NotifyCreateImage(doer *models.User, image models.Image) {
  126. }
  127. func (*NullNotifier) NotifyImageRecommend(optUser *models.User, imageId int64, action string) {
  128. }
  129. func (*NullNotifier) NotifyChangeUserAvatar(user *models.User, form auth.AvatarForm) {
  130. }