summaryrefslogtreecommitdiffstats
path: root/models/repo_watch.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-11-14 10:57:36 +0800
committerGitHub <noreply@github.com>2019-11-14 10:57:36 +0800
commitdad67cae5455f346f122ab26ec50ac4e029cacf4 (patch)
treee16407c08bb1c5ca07b9f3601e55e2c13eb79ac8 /models/repo_watch.go
parent16a43156a85710fd01fc7d8e5092fb82371fa271 (diff)
downloadgitea-dad67cae5455f346f122ab26ec50ac4e029cacf4.tar.gz
gitea-dad67cae5455f346f122ab26ec50ac4e029cacf4.zip
Refactor pull request review (#8954)
* refactor submit review * remove unnecessary code * remove unused comment * fix lint * remove duplicated actions * remove duplicated actions * fix typo * fix comment content
Diffstat (limited to 'models/repo_watch.go')
-rw-r--r--models/repo_watch.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/models/repo_watch.go b/models/repo_watch.go
index cb864fb46d..2de4f8b320 100644
--- a/models/repo_watch.go
+++ b/models/repo_watch.go
@@ -216,6 +216,21 @@ func NotifyWatchers(act *Action) error {
return notifyWatchers(x, act)
}
+// NotifyWatchersActions creates batch of actions for every watcher.
+func NotifyWatchersActions(acts []*Action) error {
+ sess := x.NewSession()
+ defer sess.Close()
+ if err := sess.Begin(); err != nil {
+ return err
+ }
+ for _, act := range acts {
+ if err := notifyWatchers(sess, act); err != nil {
+ return err
+ }
+ }
+ return sess.Commit()
+}
+
func watchIfAuto(e Engine, userID, repoID int64, isWrite bool) error {
if !isWrite || !setting.Service.AutoWatchOnChanges {
return nil