fix: Add feed for organization (#3594)

* feat: Add feed for organization

* fix: testing

* fix: testing

* fix: testing

* fix: testing
这个提交包含在:
Bo-Yi Wu 2018-03-03 13:21:16 +08:00 提交者 GitHub
父节点 990709da8f
当前提交 78b54b49fa
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 2 个文件被更改,包括 16 次插入0 次删除

查看文件

@ -339,6 +339,7 @@ func TestCommitRepoAction(t *testing.T) {
s.action.ActUserID = user.ID
s.action.RepoID = repo.ID
s.action.Repo = repo
s.action.IsPrivate = repo.IsPrivate
testCorrectRepoAction(t, s.commitRepoActionOptions, &s.action)

查看文件

@ -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