mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	add organization-level webhooks
This commit is contained in:
		| @@ -45,6 +45,7 @@ type Webhook struct { | ||||
| 	IsActive     bool | ||||
| 	HookTaskType HookTaskType | ||||
| 	Meta         string `xorm:"TEXT"` // store hook-specific attributes | ||||
| 	OrgId        int64 | ||||
| } | ||||
|  | ||||
| // GetEvent handles conversion from Events to HookEvent. | ||||
| @@ -120,6 +121,18 @@ func DeleteWebhook(hookId int64) error { | ||||
| 	return err | ||||
| } | ||||
|  | ||||
| // GetWebhooksByOrgId returns all webhooks for an organization. | ||||
| func GetWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) { | ||||
| 	err = x.Find(&ws, &Webhook{OrgId: orgId}) | ||||
| 	return ws, err | ||||
| } | ||||
|  | ||||
| // GetActiveWebhooksByOrgId returns all active webhooks for an organization. | ||||
| func GetActiveWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) { | ||||
| 	err = x.Find(&ws, &Webhook{OrgId: orgId, IsActive: true}) | ||||
| 	return ws, err | ||||
| } | ||||
|  | ||||
| //   ___ ___                __   ___________              __ | ||||
| //  /   |   \  ____   ____ |  | _\__    ___/____    _____|  | __ | ||||
| // /    ~    \/  _ \ /  _ \|  |/ / |    |  \__  \  /  ___/  |/ / | ||||
|   | ||||
		Reference in New Issue
	
	Block a user