1
0
Fork 0
forked from forgejo/forgejo

Delete issue_service.CreateComment (#26298)

I noticed that `issue_service.CreateComment` adds transaction operations
on `issues_model.CreateComment`, we can merge the two functions and we
can avoid calling each other's methods in the `services` layer.

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
caicandong 2023-08-04 21:34:34 +08:00 committed by GitHub
parent 2de0752be7
commit 6151e69d95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 31 deletions

View file

@ -125,7 +125,7 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, pull *issu
Content: string(dataJSON),
}
_, _ = issue_service.CreateComment(ctx, ops)
_, _ = issues_model.CreateComment(ctx, ops)
if !pr.IsWorkInProgress() {
if err := issues_model.PullRequestCodeOwnersReview(ctx, pull, pr); err != nil {
@ -231,7 +231,7 @@ func ChangeTargetBranch(ctx context.Context, pr *issues_model.PullRequest, doer
OldRef: oldBranch,
NewRef: targetBranch,
}
if _, err = issue_service.CreateComment(ctx, options); err != nil {
if _, err = issues_model.CreateComment(ctx, options); err != nil {
return fmt.Errorf("CreateChangeTargetBranchComment: %w", err)
}