mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
Deleting a card created no Activity (only archiving did), so the Activities.after.insert outgoing-webhook hook never fired on real deletion. Added a deleteCard Activity in the Cards before.remove hook and in the two REST card-delete endpoints (which use Cards.direct.removeAsync and bypass the hook), so an outgoing webhook is now sent on card deletion, consistent with other events. (#2950: board/list/swimlane deletion already emit removeBoard/removeList/ removeSwimlane activities, so those webhooks were already present.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
// Pure helpers that build the Activity document shape for "delete" events so the
|
|
// Activities.after.insert outgoing-webhook hook fires when a card or board is
|
|
// permanently removed (not just archived).
|
|
//
|
|
// These are intentionally side-effect free (no DB access) so they can be unit
|
|
// tested in isolation. The server remove hooks call them and pass the result to
|
|
// Activities.insertAsync().
|
|
//
|
|
// The shapes mirror the existing create/archive activities:
|
|
// - createCard / archivedCard: { userId, activityType, boardId, listId, cardId, swimlaneId, ... }
|
|
// - createBoard / removeBoard: { userId, type, activityType, activityTypeId, boardId }
|
|
|
|
export function buildDeleteCardActivity({
|
|
cardId,
|
|
boardId,
|
|
listId,
|
|
swimlaneId,
|
|
userId,
|
|
cardTitle,
|
|
} = {}) {
|
|
const activity = {
|
|
userId,
|
|
activityType: 'deleteCard',
|
|
boardId,
|
|
listId,
|
|
cardId,
|
|
swimlaneId,
|
|
};
|
|
if (cardTitle !== undefined) {
|
|
activity.cardTitle = cardTitle;
|
|
}
|
|
return activity;
|
|
}
|
|
|
|
export function buildDeleteBoardActivity({ boardId, userId } = {}) {
|
|
return {
|
|
userId,
|
|
type: 'board',
|
|
activityType: 'deleteBoard',
|
|
activityTypeId: boardId,
|
|
boardId,
|
|
};
|
|
}
|