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/action/action.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/action/action.go')
-rw-r--r-- | modules/notification/action/action.go | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go index 772e7be137..80f97ad993 100644 --- a/modules/notification/action/action.go +++ b/modules/notification/action/action.go @@ -10,6 +10,7 @@ import ( "strings" "code.gitea.io/gitea/models" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/notification/base" @@ -29,7 +30,7 @@ func NewNotifier() base.Notifier { return &actionNotifier{} } -func (a *actionNotifier) NotifyNewIssue(issue *models.Issue, mentions []*models.User) { +func (a *actionNotifier) NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) { if err := issue.LoadPoster(); err != nil { log.Error("issue.LoadPoster: %v", err) return @@ -54,7 +55,7 @@ func (a *actionNotifier) NotifyNewIssue(issue *models.Issue, mentions []*models. } // NotifyIssueChangeStatus notifies close or reopen issue to notifiers -func (a *actionNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, closeOrReopen bool) { +func (a *actionNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, closeOrReopen bool) { // Compose comment action, could be plain comment, close or reopen issue/pull request. // This object will be used to notify watchers in the end of function. act := &models.Action{ @@ -87,8 +88,8 @@ func (a *actionNotifier) NotifyIssueChangeStatus(doer *models.User, issue *model } // NotifyCreateIssueComment notifies comment on an issue to notifiers -func (a *actionNotifier) NotifyCreateIssueComment(doer *models.User, repo *models.Repository, - issue *models.Issue, comment *models.Comment, mentions []*models.User) { +func (a *actionNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *models.Repository, + issue *models.Issue, comment *models.Comment, mentions []*user_model.User) { act := &models.Action{ ActUserID: doer.ID, ActUser: doer, @@ -120,7 +121,7 @@ func (a *actionNotifier) NotifyCreateIssueComment(doer *models.User, repo *model } } -func (a *actionNotifier) NotifyNewPullRequest(pull *models.PullRequest, mentions []*models.User) { +func (a *actionNotifier) NotifyNewPullRequest(pull *models.PullRequest, mentions []*user_model.User) { if err := pull.LoadIssue(); err != nil { log.Error("pull.LoadIssue: %v", err) return @@ -147,7 +148,7 @@ func (a *actionNotifier) NotifyNewPullRequest(pull *models.PullRequest, mentions } } -func (a *actionNotifier) NotifyRenameRepository(doer *models.User, repo *models.Repository, oldRepoName string) { +func (a *actionNotifier) NotifyRenameRepository(doer *user_model.User, repo *models.Repository, oldRepoName string) { log.Trace("action.ChangeRepositoryName: %s/%s", doer.Name, repo.Name) if err := models.NotifyWatchers(&models.Action{ @@ -163,7 +164,7 @@ func (a *actionNotifier) NotifyRenameRepository(doer *models.User, repo *models. } } -func (a *actionNotifier) NotifyTransferRepository(doer *models.User, repo *models.Repository, oldOwnerName string) { +func (a *actionNotifier) NotifyTransferRepository(doer *user_model.User, repo *models.Repository, oldOwnerName string) { if err := models.NotifyWatchers(&models.Action{ ActUserID: doer.ID, ActUser: doer, @@ -177,7 +178,7 @@ func (a *actionNotifier) NotifyTransferRepository(doer *models.User, repo *model } } -func (a *actionNotifier) NotifyCreateRepository(doer *models.User, u *models.User, repo *models.Repository) { +func (a *actionNotifier) NotifyCreateRepository(doer *user_model.User, u *user_model.User, repo *models.Repository) { if err := models.NotifyWatchers(&models.Action{ ActUserID: doer.ID, ActUser: doer, @@ -190,7 +191,7 @@ func (a *actionNotifier) NotifyCreateRepository(doer *models.User, u *models.Use } } -func (a *actionNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo *models.Repository) { +func (a *actionNotifier) NotifyForkRepository(doer *user_model.User, oldRepo, repo *models.Repository) { if err := models.NotifyWatchers(&models.Action{ ActUserID: doer.ID, ActUser: doer, @@ -203,7 +204,7 @@ func (a *actionNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo * } } -func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*models.User) { +func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*user_model.User) { if err := review.LoadReviewer(); err != nil { log.Error("LoadReviewer '%d/%d': %v", review.ID, review.ReviewerID, err) return @@ -261,7 +262,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review } } -func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) { +func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) { if err := models.NotifyWatchers(&models.Action{ ActUserID: doer.ID, ActUser: doer, @@ -275,7 +276,7 @@ func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mode } } -func (*actionNotifier) NotifyPullRevieweDismiss(doer *models.User, review *models.Review, comment *models.Comment) { +func (*actionNotifier) NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) { reviewerName := review.Reviewer.Name if len(review.OriginalAuthor) > 0 { reviewerName = review.OriginalAuthor @@ -295,7 +296,7 @@ func (*actionNotifier) NotifyPullRevieweDismiss(doer *models.User, review *model } } -func (a *actionNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { +func (a *actionNotifier) NotifyPushCommits(pusher *user_model.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { data, err := json.Marshal(commits) if err != nil { log.Error("Marshal: %v", err) @@ -328,7 +329,7 @@ func (a *actionNotifier) NotifyPushCommits(pusher *models.User, repo *models.Rep } } -func (a *actionNotifier) NotifyCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) { +func (a *actionNotifier) NotifyCreateRef(doer *user_model.User, repo *models.Repository, refType, refFullName string) { opType := models.ActionCommitRepo if refType == "tag" { // has sent same action in `NotifyPushCommits`, so skip it. @@ -347,7 +348,7 @@ func (a *actionNotifier) NotifyCreateRef(doer *models.User, repo *models.Reposit } } -func (a *actionNotifier) NotifyDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) { +func (a *actionNotifier) NotifyDeleteRef(doer *user_model.User, repo *models.Repository, refType, refFullName string) { opType := models.ActionDeleteBranch if refType == "tag" { // has sent same action in `NotifyPushCommits`, so skip it. @@ -366,7 +367,7 @@ func (a *actionNotifier) NotifyDeleteRef(doer *models.User, repo *models.Reposit } } -func (a *actionNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { +func (a *actionNotifier) NotifySyncPushCommits(pusher *user_model.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { data, err := json.Marshal(commits) if err != nil { log.Error("json.Marshal: %v", err) @@ -387,7 +388,7 @@ func (a *actionNotifier) NotifySyncPushCommits(pusher *models.User, repo *models } } -func (a *actionNotifier) NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) { +func (a *actionNotifier) NotifySyncCreateRef(doer *user_model.User, repo *models.Repository, refType, refFullName string) { if err := models.NotifyWatchers(&models.Action{ ActUserID: repo.OwnerID, ActUser: repo.MustOwner(), @@ -401,7 +402,7 @@ func (a *actionNotifier) NotifySyncCreateRef(doer *models.User, repo *models.Rep } } -func (a *actionNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) { +func (a *actionNotifier) NotifySyncDeleteRef(doer *user_model.User, repo *models.Repository, refType, refFullName string) { if err := models.NotifyWatchers(&models.Action{ ActUserID: repo.OwnerID, ActUser: repo.MustOwner(), |