diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-24 17:49:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 17:49:20 +0800 |
commit | a666829a37be6f9fd98f9e7dd1767c420f7f3b32 (patch) | |
tree | 9ab1434b759a8a2cb275a83149903a823851e309 /modules/notification/notification.go | |
parent | 4e7ca946da2a2642a62f114825129bf5d7ed9196 (diff) | |
download | gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.tar.gz gitea-a666829a37be6f9fd98f9e7dd1767c420f7f3b32.zip |
Move user related model into models/user (#17781)
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
Diffstat (limited to 'modules/notification/notification.go')
-rw-r--r-- | modules/notification/notification.go | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/modules/notification/notification.go b/modules/notification/notification.go index b574f3ccda..9bea38faf6 100644 --- a/modules/notification/notification.go +++ b/modules/notification/notification.go @@ -6,6 +6,7 @@ package notification import ( "code.gitea.io/gitea/models" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/notification/action" "code.gitea.io/gitea/modules/notification/base" "code.gitea.io/gitea/modules/notification/indexer" @@ -38,92 +39,92 @@ func NewContext() { } // NotifyCreateIssueComment notifies issue comment related message to notifiers -func NotifyCreateIssueComment(doer *models.User, repo *models.Repository, - issue *models.Issue, comment *models.Comment, mentions []*models.User) { +func NotifyCreateIssueComment(doer *user_model.User, repo *models.Repository, + issue *models.Issue, comment *models.Comment, mentions []*user_model.User) { for _, notifier := range notifiers { notifier.NotifyCreateIssueComment(doer, repo, issue, comment, mentions) } } // NotifyNewIssue notifies new issue to notifiers -func NotifyNewIssue(issue *models.Issue, mentions []*models.User) { +func NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) { for _, notifier := range notifiers { notifier.NotifyNewIssue(issue, mentions) } } // NotifyIssueChangeStatus notifies close or reopen issue to notifiers -func NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, closeOrReopen bool) { +func NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, closeOrReopen bool) { for _, notifier := range notifiers { notifier.NotifyIssueChangeStatus(doer, issue, actionComment, closeOrReopen) } } // NotifyMergePullRequest notifies merge pull request to notifiers -func NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) { +func NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) { for _, notifier := range notifiers { notifier.NotifyMergePullRequest(pr, doer) } } // NotifyNewPullRequest notifies new pull request to notifiers -func NotifyNewPullRequest(pr *models.PullRequest, mentions []*models.User) { +func NotifyNewPullRequest(pr *models.PullRequest, mentions []*user_model.User) { for _, notifier := range notifiers { notifier.NotifyNewPullRequest(pr, mentions) } } // NotifyPullRequestSynchronized notifies Synchronized pull request -func NotifyPullRequestSynchronized(doer *models.User, pr *models.PullRequest) { +func NotifyPullRequestSynchronized(doer *user_model.User, pr *models.PullRequest) { for _, notifier := range notifiers { notifier.NotifyPullRequestSynchronized(doer, pr) } } // NotifyPullRequestReview notifies new pull request review -func NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*models.User) { +func NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*user_model.User) { for _, notifier := range notifiers { notifier.NotifyPullRequestReview(pr, review, comment, mentions) } } // NotifyPullRequestCodeComment notifies new pull request code comment -func NotifyPullRequestCodeComment(pr *models.PullRequest, comment *models.Comment, mentions []*models.User) { +func NotifyPullRequestCodeComment(pr *models.PullRequest, comment *models.Comment, mentions []*user_model.User) { for _, notifier := range notifiers { notifier.NotifyPullRequestCodeComment(pr, comment, mentions) } } // NotifyPullRequestChangeTargetBranch notifies when a pull request's target branch was changed -func NotifyPullRequestChangeTargetBranch(doer *models.User, pr *models.PullRequest, oldBranch string) { +func NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *models.PullRequest, oldBranch string) { for _, notifier := range notifiers { notifier.NotifyPullRequestChangeTargetBranch(doer, pr, oldBranch) } } // NotifyPullRequestPushCommits notifies when push commits to pull request's head branch -func NotifyPullRequestPushCommits(doer *models.User, pr *models.PullRequest, comment *models.Comment) { +func NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment) { for _, notifier := range notifiers { notifier.NotifyPullRequestPushCommits(doer, pr, comment) } } // NotifyPullRevieweDismiss notifies when a review was dismissed by repo admin -func NotifyPullRevieweDismiss(doer *models.User, review *models.Review, comment *models.Comment) { +func NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) { for _, notifier := range notifiers { notifier.NotifyPullRevieweDismiss(doer, review, comment) } } // NotifyUpdateComment notifies update comment to notifiers -func NotifyUpdateComment(doer *models.User, c *models.Comment, oldContent string) { +func NotifyUpdateComment(doer *user_model.User, c *models.Comment, oldContent string) { for _, notifier := range notifiers { notifier.NotifyUpdateComment(doer, c, oldContent) } } // NotifyDeleteComment notifies delete comment to notifiers -func NotifyDeleteComment(doer *models.User, c *models.Comment) { +func NotifyDeleteComment(doer *user_model.User, c *models.Comment) { for _, notifier := range notifiers { notifier.NotifyDeleteComment(doer, c) } @@ -137,70 +138,70 @@ func NotifyNewRelease(rel *models.Release) { } // NotifyUpdateRelease notifies update release to notifiers -func NotifyUpdateRelease(doer *models.User, rel *models.Release) { +func NotifyUpdateRelease(doer *user_model.User, rel *models.Release) { for _, notifier := range notifiers { notifier.NotifyUpdateRelease(doer, rel) } } // NotifyDeleteRelease notifies delete release to notifiers -func NotifyDeleteRelease(doer *models.User, rel *models.Release) { +func NotifyDeleteRelease(doer *user_model.User, rel *models.Release) { for _, notifier := range notifiers { notifier.NotifyDeleteRelease(doer, rel) } } // NotifyIssueChangeMilestone notifies change milestone to notifiers -func NotifyIssueChangeMilestone(doer *models.User, issue *models.Issue, oldMilestoneID int64) { +func NotifyIssueChangeMilestone(doer *user_model.User, issue *models.Issue, oldMilestoneID int64) { for _, notifier := range notifiers { notifier.NotifyIssueChangeMilestone(doer, issue, oldMilestoneID) } } // NotifyIssueChangeContent notifies change content to notifiers -func NotifyIssueChangeContent(doer *models.User, issue *models.Issue, oldContent string) { +func NotifyIssueChangeContent(doer *user_model.User, issue *models.Issue, oldContent string) { for _, notifier := range notifiers { notifier.NotifyIssueChangeContent(doer, issue, oldContent) } } // NotifyIssueChangeAssignee notifies change content to notifiers -func NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) { +func NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) { for _, notifier := range notifiers { notifier.NotifyIssueChangeAssignee(doer, issue, assignee, removed, comment) } } // NotifyPullReviewRequest notifies Request Review change -func NotifyPullReviewRequest(doer *models.User, issue *models.Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { +func NotifyPullReviewRequest(doer *user_model.User, issue *models.Issue, reviewer *user_model.User, isRequest bool, comment *models.Comment) { for _, notifier := range notifiers { notifier.NotifyPullReviewRequest(doer, issue, reviewer, isRequest, comment) } } // NotifyIssueClearLabels notifies clear labels to notifiers -func NotifyIssueClearLabels(doer *models.User, issue *models.Issue) { +func NotifyIssueClearLabels(doer *user_model.User, issue *models.Issue) { for _, notifier := range notifiers { notifier.NotifyIssueClearLabels(doer, issue) } } // NotifyIssueChangeTitle notifies change title to notifiers -func NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) { +func NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string) { for _, notifier := range notifiers { notifier.NotifyIssueChangeTitle(doer, issue, oldTitle) } } // NotifyIssueChangeRef notifies change reference to notifiers -func NotifyIssueChangeRef(doer *models.User, issue *models.Issue, oldRef string) { +func NotifyIssueChangeRef(doer *user_model.User, issue *models.Issue, oldRef string) { for _, notifier := range notifiers { notifier.NotifyIssueChangeRef(doer, issue, oldRef) } } // NotifyIssueChangeLabels notifies change labels to notifiers -func NotifyIssueChangeLabels(doer *models.User, issue *models.Issue, +func NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue, addedLabels []*models.Label, removedLabels []*models.Label) { for _, notifier := range notifiers { notifier.NotifyIssueChangeLabels(doer, issue, addedLabels, removedLabels) @@ -208,91 +209,91 @@ func NotifyIssueChangeLabels(doer *models.User, issue *models.Issue, } // NotifyCreateRepository notifies create repository to notifiers -func NotifyCreateRepository(doer *models.User, u *models.User, repo *models.Repository) { +func NotifyCreateRepository(doer *user_model.User, u *user_model.User, repo *models.Repository) { for _, notifier := range notifiers { notifier.NotifyCreateRepository(doer, u, repo) } } // NotifyMigrateRepository notifies create repository to notifiers -func NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository) { +func NotifyMigrateRepository(doer *user_model.User, u *user_model.User, repo *models.Repository) { for _, notifier := range notifiers { notifier.NotifyMigrateRepository(doer, u, repo) } } // NotifyTransferRepository notifies create repository to notifiers -func NotifyTransferRepository(doer *models.User, repo *models.Repository, newOwnerName string) { +func NotifyTransferRepository(doer *user_model.User, repo *models.Repository, newOwnerName string) { for _, notifier := range notifiers { notifier.NotifyTransferRepository(doer, repo, newOwnerName) } } // NotifyDeleteRepository notifies delete repository to notifiers -func NotifyDeleteRepository(doer *models.User, repo *models.Repository) { +func NotifyDeleteRepository(doer *user_model.User, repo *models.Repository) { for _, notifier := range notifiers { notifier.NotifyDeleteRepository(doer, repo) } } // NotifyForkRepository notifies fork repository to notifiers -func NotifyForkRepository(doer *models.User, oldRepo, repo *models.Repository) { +func NotifyForkRepository(doer *user_model.User, oldRepo, repo *models.Repository) { for _, notifier := range notifiers { notifier.NotifyForkRepository(doer, oldRepo, repo) } } // NotifyRenameRepository notifies repository renamed -func NotifyRenameRepository(doer *models.User, repo *models.Repository, oldName string) { +func NotifyRenameRepository(doer *user_model.User, repo *models.Repository, oldName string) { for _, notifier := range notifiers { notifier.NotifyRenameRepository(doer, repo, oldName) } } // NotifyPushCommits notifies commits pushed to notifiers -func NotifyPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { +func NotifyPushCommits(pusher *user_model.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { for _, notifier := range notifiers { notifier.NotifyPushCommits(pusher, repo, opts, commits) } } // NotifyCreateRef notifies branch or tag creation to notifiers -func NotifyCreateRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { +func NotifyCreateRef(pusher *user_model.User, repo *models.Repository, refType, refFullName string) { for _, notifier := range notifiers { notifier.NotifyCreateRef(pusher, repo, refType, refFullName) } } // NotifyDeleteRef notifies branch or tag deletion to notifiers -func NotifyDeleteRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { +func NotifyDeleteRef(pusher *user_model.User, repo *models.Repository, refType, refFullName string) { for _, notifier := range notifiers { notifier.NotifyDeleteRef(pusher, repo, refType, refFullName) } } // NotifySyncPushCommits notifies commits pushed to notifiers -func NotifySyncPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { +func NotifySyncPushCommits(pusher *user_model.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { for _, notifier := range notifiers { notifier.NotifySyncPushCommits(pusher, repo, opts, commits) } } // NotifySyncCreateRef notifies branch or tag creation to notifiers -func NotifySyncCreateRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { +func NotifySyncCreateRef(pusher *user_model.User, repo *models.Repository, refType, refFullName string) { for _, notifier := range notifiers { notifier.NotifySyncCreateRef(pusher, repo, refType, refFullName) } } // NotifySyncDeleteRef notifies branch or tag deletion to notifiers -func NotifySyncDeleteRef(pusher *models.User, repo *models.Repository, refType, refFullName string) { +func NotifySyncDeleteRef(pusher *user_model.User, repo *models.Repository, refType, refFullName string) { for _, notifier := range notifiers { notifier.NotifySyncDeleteRef(pusher, repo, refType, refFullName) } } // NotifyRepoPendingTransfer notifies creation of pending transfer to notifiers -func NotifyRepoPendingTransfer(doer, newOwner *models.User, repo *models.Repository) { +func NotifyRepoPendingTransfer(doer, newOwner *user_model.User, repo *models.Repository) { for _, notifier := range notifiers { notifier.NotifyRepoPendingTransfer(doer, newOwner, repo) } |