diff options
author | Christopher Brickley <brickley@gmail.com> | 2014-09-04 07:17:00 -0400 |
---|---|---|
committer | Christopher Brickley <brickley@gmail.com> | 2014-09-05 07:19:34 -0400 |
commit | 85c35a6b8bb7430568d375d1e792e1417bbd7f4b (patch) | |
tree | d269e4a890036a76d8f8cd60f8d65e7a0c80d865 /models/action.go | |
parent | 7269b06fd5992776c07ae0303f85e0d05b1e62e9 (diff) | |
download | gitea-85c35a6b8bb7430568d375d1e792e1417bbd7f4b.tar.gz gitea-85c35a6b8bb7430568d375d1e792e1417bbd7f4b.zip |
add organization-level webhooks
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/models/action.go b/models/action.go index f739fc353d..c0992dba68 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 } |