diff options
author | Bo-Yi Wu <appleboy.tw@gmail.com> | 2018-03-03 13:21:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-03 13:21:16 +0800 |
commit | 78b54b49fa110ed3350c1fa4c46c9ba7cf7ab68c (patch) | |
tree | fc5f656e1f2ba9999da9dc545e666251f92d7544 /models/repo_watch.go | |
parent | 990709da8fa64d51d8005146da1728f960444abd (diff) | |
download | gitea-78b54b49fa110ed3350c1fa4c46c9ba7cf7ab68c.tar.gz gitea-78b54b49fa110ed3350c1fa4c46c9ba7cf7ab68c.zip |
fix: Add feed for organization (#3594)
* feat: Add feed for organization
* fix: testing
* fix: testing
* fix: testing
* fix: testing
Diffstat (limited to 'models/repo_watch.go')
-rw-r--r-- | models/repo_watch.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/models/repo_watch.go b/models/repo_watch.go index cf9dba900a..fb89a55a11 100644 --- a/models/repo_watch.go +++ b/models/repo_watch.go @@ -87,6 +87,21 @@ func notifyWatchers(e Engine, act *Action) error { return fmt.Errorf("insert new actioner: %v", err) } + act.loadRepo() + // check repo owner exist. + if err := act.Repo.getOwner(e); err != nil { + return fmt.Errorf("can't get repo owner: %v", err) + } + + // Add feed for organization + if act.Repo.Owner.IsOrganization() && act.ActUserID != act.Repo.Owner.ID { + act.ID = 0 + act.UserID = act.Repo.Owner.ID + if _, err = e.InsertOne(act); err != nil { + return fmt.Errorf("insert new actioner: %v", err) + } + } + for i := range watches { if act.ActUserID == watches[i].UserID { continue |