summaryrefslogtreecommitdiffstats
path: root/modules/notification
diff options
context:
space:
mode:
author赵智超 <1012112796@qq.com>2020-07-30 03:20:54 +0800
committerGitHub <noreply@github.com>2020-07-29 15:20:54 -0400
commit1f12dc8e8862da8546fd9d984abdc7f69dd95f11 (patch)
treec90da9326eb89dc57cf7e9625fe34542a88b41b4 /modules/notification
parent2fd78c151e0e49db113078095f1d9e8c7478e828 (diff)
downloadgitea-1f12dc8e8862da8546fd9d984abdc7f69dd95f11.tar.gz
gitea-1f12dc8e8862da8546fd9d984abdc7f69dd95f11.zip
Add action feed for new release (#12324)
* Add action feed for new release Signed-off-by: a1012112796 <1012112796@qq.com> * fix lint * Apply suggestions from code review * Add ReleaseID to the action table * Remove error message * Fold the attachments download list * remove attchment download list * simplify code * fix create release from existing tag * simplify ui * translation change * fix test Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/notification')
-rw-r--r--modules/notification/action/action.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index 9956940f30..040cf3df10 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -314,3 +314,22 @@ func (a *actionNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Rep
log.Error("notifyWatchers: %v", err)
}
}
+
+func (a *actionNotifier) NotifyNewRelease(rel *models.Release) {
+ if err := rel.LoadAttributes(); err != nil {
+ log.Error("NotifyNewRelease: %v", err)
+ return
+ }
+ if err := models.NotifyWatchers(&models.Action{
+ ActUserID: rel.PublisherID,
+ ActUser: rel.Publisher,
+ OpType: models.ActionPublishRelease,
+ RepoID: rel.RepoID,
+ Repo: rel.Repo,
+ IsPrivate: rel.Repo.IsPrivate,
+ Content: rel.Title,
+ RefName: rel.TagName,
+ }); err != nil {
+ log.Error("notifyWatchers: %v", err)
+ }
+}