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.

notifier.go 3.7 kB

3 years ago
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>
6 years ago
3 years ago
3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2018 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. // Notifier defines an interface to notify receiver
  11. type Notifier interface {
  12. Run()
  13. NotifyCreateRepository(doer *models.User, u *models.User, repo *models.Repository)
  14. NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository)
  15. NotifyDeleteRepository(doer *models.User, repo *models.Repository)
  16. NotifyForkRepository(doer *models.User, oldRepo, repo *models.Repository)
  17. NotifyRenameRepository(doer *models.User, repo *models.Repository, oldRepoName string)
  18. NotifyAliasRepository(doer *models.User, repo *models.Repository, oldAlias string)
  19. NotifyTransferRepository(doer *models.User, repo *models.Repository, oldOwnerName string)
  20. NotifyNewIssue(*models.Issue)
  21. NotifyIssueChangeStatus(*models.User, *models.Issue, *models.Comment, bool)
  22. NotifyIssueChangeMilestone(doer *models.User, issue *models.Issue, oldMilestoneID int64)
  23. NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment)
  24. NotifyPullReviewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment)
  25. NotifyIssueChangeContent(doer *models.User, issue *models.Issue, oldContent string)
  26. NotifyIssueClearLabels(doer *models.User, issue *models.Issue)
  27. NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string)
  28. NotifyIssueChangeLabels(doer *models.User, issue *models.Issue,
  29. addedLabels []*models.Label, removedLabels []*models.Label)
  30. NotifyNewPullRequest(*models.PullRequest)
  31. NotifyMergePullRequest(*models.PullRequest, *models.User)
  32. NotifyPullRequestSynchronized(doer *models.User, pr *models.PullRequest)
  33. NotifyPullRequestReview(*models.PullRequest, *models.Review, *models.Comment)
  34. NotifyPullRequestChangeTargetBranch(doer *models.User, pr *models.PullRequest, oldBranch string)
  35. NotifyCreateIssueComment(*models.User, *models.Repository,
  36. *models.Issue, *models.Comment)
  37. NotifyUpdateComment(*models.User, *models.Comment, string)
  38. NotifyDeleteComment(*models.User, *models.Comment)
  39. NotifyNewRelease(rel *models.Release)
  40. NotifyUpdateRelease(doer *models.User, rel *models.Release)
  41. NotifyDeleteRelease(doer *models.User, rel *models.Release)
  42. NotifyPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits)
  43. NotifyCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string)
  44. NotifyDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string)
  45. NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits)
  46. NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string)
  47. NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string)
  48. NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType)
  49. NotifyWechatBind(user *models.User, wechatOpenId string)
  50. NotifyDatasetRecommend(optUser *models.User, dataset *models.Dataset, action string)
  51. NotifyCreateImage(doer *models.User, image models.Image)
  52. NotifyImageRecommend(optUser *models.User, image *models.Image, action string)
  53. NotifyChangeUserAvatar(user *models.User, form auth.AvatarForm)
  54. NotifyChangeCloudbrainStatus(cloudbrain *models.Cloudbrain, oldStatus string)
  55. }