diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-09-06 02:37:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 18:37:47 +0000 |
commit | 540bf9fa6d0d86297c9d575640798b718767bd9f (patch) | |
tree | 4b4a782b71e6f066af6c7807337745dc5ee6899a /services/release | |
parent | 084eacb5d42f1ed2520442a4bbc91bb70c9759e1 (diff) | |
download | gitea-540bf9fa6d0d86297c9d575640798b718767bd9f.tar.gz gitea-540bf9fa6d0d86297c9d575640798b718767bd9f.zip |
Move notification interface to services layer (#26915)
Extract from #22266
Diffstat (limited to 'services/release')
-rw-r--r-- | services/release/release.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/services/release/release.go b/services/release/release.go index 1ccbd9c811..ac3acc9085 100644 --- a/services/release/release.go +++ b/services/release/release.go @@ -17,11 +17,11 @@ import ( "code.gitea.io/gitea/modules/container" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/notification" "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/storage" "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" + notify_service "code.gitea.io/gitea/services/notify" ) func createTag(ctx context.Context, gitRepo *git.Repository, rel *repo_model.Release, msg string) (bool, error) { @@ -81,14 +81,14 @@ func createTag(ctx context.Context, gitRepo *git.Repository, rel *repo_model.Rel commits.CompareURL = rel.Repo.ComposeCompareURL(git.EmptySHA, commit.ID.String()) refFullName := git.RefNameFromTag(rel.TagName) - notification.NotifyPushCommits( + notify_service.PushCommits( ctx, rel.Publisher, rel.Repo, &repository.PushUpdateOptions{ RefFullName: refFullName, OldCommitID: git.EmptySHA, NewCommitID: commit.ID.String(), }, commits) - notification.NotifyCreateRef(ctx, rel.Publisher, rel.Repo, refFullName, commit.ID.String()) + notify_service.CreateRef(ctx, rel.Publisher, rel.Repo, refFullName, commit.ID.String()) rel.CreatedUnix = timeutil.TimeStampNow() } commit, err := gitRepo.GetTagCommit(rel.TagName) @@ -139,7 +139,7 @@ func CreateRelease(gitRepo *git.Repository, rel *repo_model.Release, attachmentU } if !rel.IsDraft { - notification.NotifyNewRelease(gitRepo.Ctx, rel) + notify_service.NewRelease(gitRepo.Ctx, rel) } return nil @@ -279,12 +279,12 @@ func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_mod } if !isCreated { - notification.NotifyUpdateRelease(gitRepo.Ctx, doer, rel) + notify_service.UpdateRelease(gitRepo.Ctx, doer, rel) return nil } if !rel.IsDraft { - notification.NotifyNewRelease(gitRepo.Ctx, rel) + notify_service.NewRelease(gitRepo.Ctx, rel) } return nil @@ -325,14 +325,14 @@ func DeleteReleaseByID(ctx context.Context, id int64, doer *user_model.User, del } refName := git.RefNameFromTag(rel.TagName) - notification.NotifyPushCommits( + notify_service.PushCommits( ctx, doer, repo, &repository.PushUpdateOptions{ RefFullName: refName, OldCommitID: rel.Sha1, NewCommitID: git.EmptySHA, }, repository.NewPushCommits()) - notification.NotifyDeleteRef(ctx, doer, repo, refName) + notify_service.DeleteRef(ctx, doer, repo, refName) if err := repo_model.DeleteReleaseByID(ctx, id); err != nil { return fmt.Errorf("DeleteReleaseByID: %w", err) @@ -361,7 +361,7 @@ func DeleteReleaseByID(ctx context.Context, id int64, doer *user_model.User, del } } - notification.NotifyDeleteRelease(ctx, doer, rel) + notify_service.DeleteRelease(ctx, doer, rel) return nil } |