aboutsummaryrefslogtreecommitdiff
path: root/models/action.go
diff options
context:
space:
mode:
author无闻 <joe2010xtmf@163.com>2014-09-07 19:30:51 -0400
committer无闻 <joe2010xtmf@163.com>2014-09-07 19:30:51 -0400
commite79e4b158090bf7c5dd86ac21cd0dbf44fbc82bd (patch)
treeaec4d8a53265080363b3ab7a4423bc0820133ea5 /models/action.go
parent40bc130b19cf71a997d5073a2587ea2649128bf8 (diff)
parentf7be61c81935a30c21797351db5da32183e3188d (diff)
Merge pull request #442 from compressed/org_hook
Organization-level Webhooks
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/models/action.go b/models/action.go
index f739fc35..c0992dba 100644
--- a/models/action.go
+++ b/models/action.go
@@ -220,8 +220,20 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
ws, err := GetActiveWebhooksByRepoId(repoId)
if err != nil {
- return errors.New("action.CommitRepoAction(GetWebhooksByRepoId): " + err.Error())
- } else if len(ws) == 0 {
+ return errors.New("action.CommitRepoAction(GetActiveWebhooksByRepoId): " + err.Error())
+ }
+
+ // check if repo belongs to org and append additional webhooks
+ if repo.Owner.IsOrganization() {
+ // get hooks for org
+ orgws, err := GetActiveWebhooksByOrgId(repo.OwnerId)
+ if err != nil {
+ return errors.New("action.CommitRepoAction(GetActiveWebhooksByOrgId): " + err.Error())
+ }
+ ws = append(ws, orgws...)
+ }
+
+ if len(ws) == 0 {
return nil
}