summaryrefslogtreecommitdiffstats
path: root/models/webhook.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/webhook.go')
-rw-r--r--models/webhook.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/models/webhook.go b/models/webhook.go
index 6d8b8c1682..7a42093b5a 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -174,10 +174,10 @@ func CreateWebhook(w *Webhook) error {
return err
}
-// GetWebhookByID returns webhook by given ID.
-func GetWebhookByID(id int64) (*Webhook, error) {
+// GetWebhookByID returns webhook of repository by given ID.
+func GetWebhookByID(repoID, id int64) (*Webhook, error) {
w := new(Webhook)
- has, err := x.Id(id).Get(w)
+ has, err := x.Id(id).And("repo_id=?", repoID).Get(w)
if err != nil {
return nil, err
} else if !has {
@@ -548,7 +548,7 @@ func (t *HookTask) deliver() {
}
// Update webhook last delivery status.
- w, err := GetWebhookByID(t.HookID)
+ w, err := GetWebhookByID(t.RepoID, t.HookID)
if err != nil {
log.Error(5, "GetWebhookByID: %v", err)
return