Skip to content

Commit

Permalink
fix: Add feed for organization (go-gitea#3594)
Browse files Browse the repository at this point in the history
* feat: Add feed for organization

* fix: testing

* fix: testing

* fix: testing

* fix: testing
  • Loading branch information
appleboy authored Mar 3, 2018
1 parent 990709d commit 78b54b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions models/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions models/repo_watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 78b54b4

Please sign in to comment.