Move notification interface to services layer (#26915)

Extract from #22266
This commit is contained in:
Lunny Xiao 2023-09-06 02:37:47 +08:00 committed by GitHub
parent 084eacb5d4
commit 540bf9fa6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 972 additions and 969 deletions

View file

@ -17,9 +17,9 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
notify_service "code.gitea.io/gitea/services/notify"
)
var notEnoughLines = regexp.MustCompile(`fatal: file .* has only \d+ lines?`)
@ -113,7 +113,7 @@ func CreateCodeComment(ctx context.Context, doer *user_model.User, gitRepo *git.
return nil, err
}
notification.NotifyCreateIssueComment(ctx, doer, issue.Repo, issue, comment, mentions)
notify_service.CreateIssueComment(ctx, doer, issue.Repo, issue, comment, mentions)
return comment, nil
}
@ -298,7 +298,7 @@ func SubmitReview(ctx context.Context, doer *user_model.User, gitRepo *git.Repos
return nil, nil, err
}
notification.NotifyPullRequestReview(ctx, pr, review, comm, mentions)
notify_service.PullRequestReview(ctx, pr, review, comm, mentions)
for _, lines := range review.CodeComments {
for _, comments := range lines {
@ -307,7 +307,7 @@ func SubmitReview(ctx context.Context, doer *user_model.User, gitRepo *git.Repos
if err != nil {
return nil, nil, err
}
notification.NotifyPullRequestCodeComment(ctx, pr, codeComment, mentions)
notify_service.PullRequestCodeComment(ctx, pr, codeComment, mentions)
}
}
}
@ -355,7 +355,7 @@ func DismissApprovalReviews(ctx context.Context, doer *user_model.User, pull *is
comment.Poster = doer
comment.Issue = review.Issue
notification.NotifyPullReviewDismiss(ctx, doer, review, comment)
notify_service.PullReviewDismiss(ctx, doer, review, comment)
}
return nil
})
@ -426,7 +426,7 @@ func DismissReview(ctx context.Context, reviewID, repoID int64, message string,
comment.Poster = doer
comment.Issue = review.Issue
notification.NotifyPullReviewDismiss(ctx, doer, review, comment)
notify_service.PullReviewDismiss(ctx, doer, review, comment)
return comment, nil
}