2018-10-18 19:23:05 +08:00
|
|
|
// Copyright 2018 The Gitea Authors. All rights reserved.
|
2016-12-31 00:44:54 +08:00
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package notification
|
|
|
|
|
|
|
|
import (
|
|
|
|
"code.gitea.io/gitea/models"
|
2022-03-30 16:42:47 +08:00
|
|
|
packages_model "code.gitea.io/gitea/models/packages"
|
2021-12-10 09:27:50 +08:00
|
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
2021-11-24 17:49:20 +08:00
|
|
|
user_model "code.gitea.io/gitea/models/user"
|
2019-11-04 04:59:09 +08:00
|
|
|
"code.gitea.io/gitea/modules/notification/action"
|
2018-10-18 19:23:05 +08:00
|
|
|
"code.gitea.io/gitea/modules/notification/base"
|
2019-01-17 22:23:22 +08:00
|
|
|
"code.gitea.io/gitea/modules/notification/indexer"
|
2019-01-13 22:42:55 +08:00
|
|
|
"code.gitea.io/gitea/modules/notification/mail"
|
2018-10-18 19:23:05 +08:00
|
|
|
"code.gitea.io/gitea/modules/notification/ui"
|
2019-10-15 13:03:05 +08:00
|
|
|
"code.gitea.io/gitea/modules/notification/webhook"
|
2020-01-10 17:34:21 +08:00
|
|
|
"code.gitea.io/gitea/modules/repository"
|
2019-10-25 22:46:37 +08:00
|
|
|
"code.gitea.io/gitea/modules/setting"
|
2016-12-31 00:44:54 +08:00
|
|
|
)
|
|
|
|
|
2022-01-21 01:46:10 +08:00
|
|
|
var notifiers []base.Notifier
|
2018-10-18 19:23:05 +08:00
|
|
|
|
|
|
|
// RegisterNotifier providers method to receive notify messages
|
|
|
|
func RegisterNotifier(notifier base.Notifier) {
|
|
|
|
go notifier.Run()
|
|
|
|
notifiers = append(notifiers, notifier)
|
|
|
|
}
|
|
|
|
|
2019-10-25 22:46:37 +08:00
|
|
|
// NewContext registers notification handlers
|
|
|
|
func NewContext() {
|
2018-10-18 19:23:05 +08:00
|
|
|
RegisterNotifier(ui.NewNotifier())
|
2019-10-25 22:46:37 +08:00
|
|
|
if setting.Service.EnableNotifyMail {
|
|
|
|
RegisterNotifier(mail.NewNotifier())
|
|
|
|
}
|
2019-01-17 22:23:22 +08:00
|
|
|
RegisterNotifier(indexer.NewNotifier())
|
2019-10-15 13:03:05 +08:00
|
|
|
RegisterNotifier(webhook.NewNotifier())
|
2019-11-04 04:59:09 +08:00
|
|
|
RegisterNotifier(action.NewNotifier())
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyCreateIssueComment notifies issue comment related message to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
|
2022-02-24 04:16:07 +08:00
|
|
|
issue *models.Issue, comment *models.Comment, mentions []*user_model.User,
|
|
|
|
) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
2021-01-03 01:04:02 +08:00
|
|
|
notifier.NotifyCreateIssueComment(doer, repo, issue, comment, mentions)
|
2016-12-31 00:44:54 +08:00
|
|
|
}
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
2016-12-31 00:44:54 +08:00
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyNewIssue notifies new issue to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
2021-01-03 01:04:02 +08:00
|
|
|
notifier.NotifyNewIssue(issue, mentions)
|
2016-12-31 00:44:54 +08:00
|
|
|
}
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
2016-12-31 00:44:54 +08:00
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyIssueChangeStatus notifies close or reopen issue to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, closeOrReopen bool) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
2019-12-16 05:57:34 +08:00
|
|
|
notifier.NotifyIssueChangeStatus(doer, issue, actionComment, closeOrReopen)
|
2016-12-31 00:44:54 +08:00
|
|
|
}
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
2016-12-31 00:44:54 +08:00
|
|
|
|
2022-03-01 08:20:15 +08:00
|
|
|
// NotifyDeleteIssue notify when some issue deleted
|
|
|
|
func NotifyDeleteIssue(doer *user_model.User, issue *models.Issue) {
|
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyDeleteIssue(doer, issue)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyMergePullRequest notifies merge pull request to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
2020-01-17 00:24:20 +08:00
|
|
|
notifier.NotifyMergePullRequest(pr, doer)
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyNewPullRequest notifies new pull request to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyNewPullRequest(pr *models.PullRequest, mentions []*user_model.User) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
2021-01-03 01:04:02 +08:00
|
|
|
notifier.NotifyNewPullRequest(pr, mentions)
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-05 19:04:08 +08:00
|
|
|
// NotifyPullRequestSynchronized notifies Synchronized pull request
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyPullRequestSynchronized(doer *user_model.User, pr *models.PullRequest) {
|
2019-11-05 19:04:08 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyPullRequestSynchronized(doer, pr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyPullRequestReview notifies new pull request review
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*user_model.User) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
2021-01-03 01:04:02 +08:00
|
|
|
notifier.NotifyPullRequestReview(pr, review, comment, mentions)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyPullRequestCodeComment notifies new pull request code comment
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyPullRequestCodeComment(pr *models.PullRequest, comment *models.Comment, mentions []*user_model.User) {
|
2021-01-03 01:04:02 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyPullRequestCodeComment(pr, comment, mentions)
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-16 14:20:25 +08:00
|
|
|
// NotifyPullRequestChangeTargetBranch notifies when a pull request's target branch was changed
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *models.PullRequest, oldBranch string) {
|
2019-12-16 14:20:25 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyPullRequestChangeTargetBranch(doer, pr, oldBranch)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-20 20:47:24 +08:00
|
|
|
// NotifyPullRequestPushCommits notifies when push commits to pull request's head branch
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment) {
|
2020-05-20 20:47:24 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyPullRequestPushCommits(doer, pr, comment)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-12 01:32:25 +08:00
|
|
|
// NotifyPullRevieweDismiss notifies when a review was dismissed by repo admin
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) {
|
2021-02-12 01:32:25 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyPullRevieweDismiss(doer, review, comment)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyUpdateComment notifies update comment to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyUpdateComment(doer *user_model.User, c *models.Comment, oldContent string) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyUpdateComment(doer, c, oldContent)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyDeleteComment notifies delete comment to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyDeleteComment(doer *user_model.User, c *models.Comment) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyDeleteComment(doer, c)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyNewRelease notifies new release to notifiers
|
|
|
|
func NotifyNewRelease(rel *models.Release) {
|
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyNewRelease(rel)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyUpdateRelease notifies update release to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyUpdateRelease(doer *user_model.User, rel *models.Release) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyUpdateRelease(doer, rel)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyDeleteRelease notifies delete release to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyDeleteRelease(doer *user_model.User, rel *models.Release) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyDeleteRelease(doer, rel)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyIssueChangeMilestone notifies change milestone to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyIssueChangeMilestone(doer *user_model.User, issue *models.Issue, oldMilestoneID int64) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
2019-11-02 11:33:20 +08:00
|
|
|
notifier.NotifyIssueChangeMilestone(doer, issue, oldMilestoneID)
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyIssueChangeContent notifies change content to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyIssueChangeContent(doer *user_model.User, issue *models.Issue, oldContent string) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyIssueChangeContent(doer, issue, oldContent)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyIssueChangeAssignee notifies change content to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
2019-10-25 22:46:37 +08:00
|
|
|
notifier.NotifyIssueChangeAssignee(doer, issue, assignee, removed, comment)
|
2018-10-18 19:23:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-01 04:24:08 +08:00
|
|
|
// NotifyPullReviewRequest notifies Request Review change
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyPullReviewRequest(doer *user_model.User, issue *models.Issue, reviewer *user_model.User, isRequest bool, comment *models.Comment) {
|
2020-04-07 00:33:34 +08:00
|
|
|
for _, notifier := range notifiers {
|
2020-05-01 04:24:08 +08:00
|
|
|
notifier.NotifyPullReviewRequest(doer, issue, reviewer, isRequest, comment)
|
2020-04-07 00:33:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyIssueClearLabels notifies clear labels to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyIssueClearLabels(doer *user_model.User, issue *models.Issue) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyIssueClearLabels(doer, issue)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyIssueChangeTitle notifies change title to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyIssueChangeTitle(doer, issue, oldTitle)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-09 00:29:51 +08:00
|
|
|
// NotifyIssueChangeRef notifies change reference to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyIssueChangeRef(doer *user_model.User, issue *models.Issue, oldRef string) {
|
2020-09-09 00:29:51 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyIssueChangeRef(doer, issue, oldRef)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyIssueChangeLabels notifies change labels to notifiers
|
2021-11-24 17:49:20 +08:00
|
|
|
func NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
|
2022-02-24 04:16:07 +08:00
|
|
|
addedLabels, removedLabels []*models.Label,
|
|
|
|
) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyIssueChangeLabels(doer, issue, addedLabels, removedLabels)
|
|
|
|
}
|
2016-12-31 00:44:54 +08:00
|
|
|
}
|
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyCreateRepository notifies create repository to notifiers
|
2021-12-20 12:41:31 +08:00
|
|
|
func NotifyCreateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyCreateRepository(doer, u, repo)
|
2016-12-31 00:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-18 19:23:05 +08:00
|
|
|
// NotifyMigrateRepository notifies create repository to notifiers
|
2021-12-20 12:41:31 +08:00
|
|
|
func NotifyMigrateRepository(doer, u *user_model.User, repo *repo_model.Repository) {
|
2018-10-18 19:23:05 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyMigrateRepository(doer, u, repo)
|
2016-12-31 00:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
2019-11-03 14:59:26 +08:00
|
|
|
|
2019-11-15 16:06:11 +08:00
|
|
|
// NotifyTransferRepository notifies create repository to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifyTransferRepository(doer *user_model.User, repo *repo_model.Repository, newOwnerName string) {
|
2019-11-15 16:06:11 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyTransferRepository(doer, repo, newOwnerName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyDeleteRepository notifies delete repository to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifyDeleteRepository(doer *user_model.User, repo *repo_model.Repository) {
|
2019-11-15 16:06:11 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyDeleteRepository(doer, repo)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyForkRepository notifies fork repository to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifyForkRepository(doer *user_model.User, oldRepo, repo *repo_model.Repository) {
|
2019-11-15 16:06:11 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyForkRepository(doer, oldRepo, repo)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyRenameRepository notifies repository renamed
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifyRenameRepository(doer *user_model.User, repo *repo_model.Repository, oldName string) {
|
2019-11-15 16:06:11 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyRenameRepository(doer, repo, oldName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-03 14:59:26 +08:00
|
|
|
// NotifyPushCommits notifies commits pushed to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifyPushCommits(pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) {
|
2019-11-03 14:59:26 +08:00
|
|
|
for _, notifier := range notifiers {
|
2020-10-31 05:59:02 +08:00
|
|
|
notifier.NotifyPushCommits(pusher, repo, opts, commits)
|
2019-11-03 14:59:26 +08:00
|
|
|
}
|
|
|
|
}
|
2019-11-06 14:43:03 +08:00
|
|
|
|
|
|
|
// NotifyCreateRef notifies branch or tag creation to notifiers
|
2022-01-20 07:26:57 +08:00
|
|
|
func NotifyCreateRef(pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) {
|
2019-11-06 14:43:03 +08:00
|
|
|
for _, notifier := range notifiers {
|
2022-01-20 07:26:57 +08:00
|
|
|
notifier.NotifyCreateRef(pusher, repo, refType, refFullName, refID)
|
2019-11-06 14:43:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyDeleteRef notifies branch or tag deletion to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifyDeleteRef(pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) {
|
2019-11-06 14:43:03 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyDeleteRef(pusher, repo, refType, refFullName)
|
|
|
|
}
|
|
|
|
}
|
2019-11-24 13:16:59 +08:00
|
|
|
|
|
|
|
// NotifySyncPushCommits notifies commits pushed to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifySyncPushCommits(pusher *user_model.User, repo *repo_model.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) {
|
2019-11-24 13:16:59 +08:00
|
|
|
for _, notifier := range notifiers {
|
2020-10-31 05:59:02 +08:00
|
|
|
notifier.NotifySyncPushCommits(pusher, repo, opts, commits)
|
2019-11-24 13:16:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifySyncCreateRef notifies branch or tag creation to notifiers
|
2022-01-20 07:26:57 +08:00
|
|
|
func NotifySyncCreateRef(pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) {
|
2019-11-24 13:16:59 +08:00
|
|
|
for _, notifier := range notifiers {
|
2022-01-20 07:26:57 +08:00
|
|
|
notifier.NotifySyncCreateRef(pusher, repo, refType, refFullName, refID)
|
2019-11-24 13:16:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifySyncDeleteRef notifies branch or tag deletion to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifySyncDeleteRef(pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) {
|
2019-11-24 13:16:59 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifySyncDeleteRef(pusher, repo, refType, refFullName)
|
|
|
|
}
|
|
|
|
}
|
2021-03-01 08:47:30 +08:00
|
|
|
|
|
|
|
// NotifyRepoPendingTransfer notifies creation of pending transfer to notifiers
|
2021-12-10 09:27:50 +08:00
|
|
|
func NotifyRepoPendingTransfer(doer, newOwner *user_model.User, repo *repo_model.Repository) {
|
2021-03-01 08:47:30 +08:00
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyRepoPendingTransfer(doer, newOwner, repo)
|
|
|
|
}
|
|
|
|
}
|
2022-03-30 16:42:47 +08:00
|
|
|
|
|
|
|
// NotifyPackageCreate notifies creation of a package to notifiers
|
|
|
|
func NotifyPackageCreate(doer *user_model.User, pd *packages_model.PackageDescriptor) {
|
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyPackageCreate(doer, pd)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotifyPackageDelete notifies deletion of a package to notifiers
|
|
|
|
func NotifyPackageDelete(doer *user_model.User, pd *packages_model.PackageDescriptor) {
|
|
|
|
for _, notifier := range notifiers {
|
|
|
|
notifier.NotifyPackageDelete(doer, pd)
|
|
|
|
}
|
|
|
|
}
|