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.

task.go 2.6 kB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package task
  2. import (
  3. "code.gitea.io/gitea/models"
  4. "code.gitea.io/gitea/modules/notification/base"
  5. "code.gitea.io/gitea/modules/repository"
  6. "code.gitea.io/gitea/services/task"
  7. "fmt"
  8. )
  9. type taskNotifier struct {
  10. base.NullNotifier
  11. }
  12. var (
  13. _ base.Notifier = &taskNotifier{}
  14. )
  15. // NewNotifier create a new actionNotifier notifier
  16. func NewNotifier() base.Notifier {
  17. return &taskNotifier{}
  18. }
  19. func (t *taskNotifier) NotifyNewIssue(issue *models.Issue) {
  20. task.Accomplish(issue.Poster.ID, models.TaskTypeNewIssue, fmt.Sprint(issue.ID))
  21. }
  22. // NotifyIssueChangeStatus notifies close or reopen issue to notifiers
  23. func (t *taskNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, closeOrReopen bool) {
  24. return
  25. }
  26. // NotifyCreateIssueComment notifies comment on an issue to notifiers
  27. func (t *taskNotifier) NotifyCreateIssueComment(doer *models.User, repo *models.Repository,
  28. issue *models.Issue, comment *models.Comment) {
  29. task.Accomplish(doer.ID, models.TaskTypeCreateIssueComment, fmt.Sprint(comment.ID))
  30. }
  31. func (t *taskNotifier) NotifyNewPullRequest(pull *models.PullRequest) {
  32. task.Accomplish(pull.Issue.Poster.ID, models.TaskTypeCreateIssueComment, fmt.Sprint(pull.ID))
  33. }
  34. func (t *taskNotifier) NotifyRenameRepository(doer *models.User, repo *models.Repository, oldRepoName string) {
  35. return
  36. }
  37. func (t *taskNotifier) NotifyAliasRepository(doer *models.User, repo *models.Repository, oldAlias string) {
  38. return
  39. }
  40. func (t *taskNotifier) NotifyTransferRepository(doer *models.User, repo *models.Repository, oldOwnerName string) {
  41. return
  42. }
  43. func (t *taskNotifier) NotifyCreateRepository(doer *models.User, u *models.User, repo *models.Repository) {
  44. return
  45. }
  46. func (t *taskNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo *models.Repository) {
  47. return
  48. }
  49. func (t *taskNotifier) NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment) {
  50. return
  51. }
  52. func (t *taskNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) {
  53. return
  54. }
  55. func (t *taskNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) {
  56. return
  57. }
  58. func (t *taskNotifier) NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
  59. return
  60. }
  61. func (t *taskNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) {
  62. return
  63. }
  64. func (t *taskNotifier) NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) {
  65. return
  66. }