feat: filter webhooks per project, board, and account
Adds optional project, board, and acting-user scope to each webhook so events from a specific board or project can be routed to a single endpoint without an external automation tool in the middle (closes #1457). A webhook now fires for an event only when every set scope matches: empty scope still means "fire for everything", keeping existing webhooks working unchanged. Scope filtering is centralized in the sendWebhooks helper, which auto-derives projectId/boardId from the event payload, so existing call sites are untouched.
This commit is contained in:
@@ -18,11 +18,21 @@ export default class extends BaseModel {
|
||||
accessToken: attr(),
|
||||
events: attr(),
|
||||
excludedEvents: attr(),
|
||||
projectId: fk({
|
||||
to: 'Project',
|
||||
as: 'project',
|
||||
relatedName: 'webhooks',
|
||||
}),
|
||||
boardId: fk({
|
||||
to: 'Board',
|
||||
as: 'board',
|
||||
relatedName: 'webhooks',
|
||||
}),
|
||||
userId: fk({
|
||||
to: 'User',
|
||||
as: 'user',
|
||||
relatedName: 'webhooks',
|
||||
}),
|
||||
};
|
||||
|
||||
static reducer({ type, payload }, Webhook) {
|
||||
|
||||
Reference in New Issue
Block a user