mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
The reporter puts a card at the bottom of the next list when it moves on and at the top when it moves back. With only "moved to" and "moved from" a list triggers, that needs a rule for every pair of lists. "A card is moved forward to a later list" and "moved back to an earlier list" now fire on any move between two lists of the board, compared by the lists' order rather than by the screen, so they also work in right-to-left languages. They are matched on the rule's own board, like the other trigger kinds (models/lib/ruleMoveDirection.js). tests/ruleMoveDirection.test.cjs covers the directions and what has none; a Playwright case moves cards both ways through the REST API. The RepointBleed guard counts the new matching path. New text is in English, pending Transifex. Thanks to rlach and xet7 ! Fixes #2076.
112 lines
3.7 KiB
JavaScript
112 lines
3.7 KiB
JavaScript
// Maps each event `activityType` to the trigger fields used to match rules.
|
|
// NOTE: two trigger kinds are intentionally NOT listed here because they are not
|
|
// driven by activities:
|
|
// - 'scheduledTrigger' (time/due/aging) is evaluated by server/scheduledRules.js
|
|
// via SyncedCron.
|
|
// - 'button' (card/board manual buttons) runs only via the rules.runButton method.
|
|
// - 'advancedFilterTrigger' and 'textContainsTrigger' (#2194 "card title/
|
|
// description contains {value}") are not exact/wildcard field matches
|
|
// either - server/rulesHelper.js re-reads the card's current state and
|
|
// evaluates them directly (see cardMatchesAdvancedFilter /
|
|
// cardTextContainsMatch) on createCard/a-changedTitle/a-changedDescription.
|
|
// - 'moveCardDirection' (#2076 "a card is moved forward / back") compares
|
|
// the old and new list's order on each moveCard activity
|
|
// (models/lib/ruleMoveDirection.js), so it is matched directly as well.
|
|
export const TriggersDef = {
|
|
createCard: {
|
|
matchingFields: [
|
|
'boardId',
|
|
'listName',
|
|
'userId',
|
|
'swimlaneName',
|
|
'cardTitle',
|
|
],
|
|
},
|
|
moveCard: {
|
|
matchingFields: [
|
|
'boardId',
|
|
'listName',
|
|
'oldListName',
|
|
'userId',
|
|
'swimlaneName',
|
|
'cardTitle',
|
|
],
|
|
},
|
|
archivedCard: {
|
|
matchingFields: ['boardId', 'userId', 'cardTitle'],
|
|
},
|
|
restoredCard: {
|
|
matchingFields: ['boardId', 'userId', 'cardTitle'],
|
|
},
|
|
joinMember: {
|
|
matchingFields: ['boardId', 'username', 'userId'],
|
|
},
|
|
unjoinMember: {
|
|
matchingFields: ['boardId', 'username', 'userId'],
|
|
},
|
|
joinAssignee: {
|
|
matchingFields: ['boardId', 'username', 'userId'],
|
|
},
|
|
unjoinAssignee: {
|
|
matchingFields: ['boardId', 'username', 'userId'],
|
|
},
|
|
addChecklist: {
|
|
matchingFields: ['boardId', 'checklistName', 'userId'],
|
|
},
|
|
removeChecklist: {
|
|
matchingFields: ['boardId', 'checklistName', 'userId'],
|
|
},
|
|
completeChecklist: {
|
|
matchingFields: ['boardId', 'checklistName', 'userId'],
|
|
},
|
|
uncompleteChecklist: {
|
|
matchingFields: ['boardId', 'checklistName', 'userId'],
|
|
},
|
|
addedChecklistItem: {
|
|
matchingFields: ['boardId', 'checklistItemName', 'userId'],
|
|
},
|
|
removedChecklistItem: {
|
|
matchingFields: ['boardId', 'checklistItemName', 'userId'],
|
|
},
|
|
checkedItem: {
|
|
matchingFields: ['boardId', 'checklistItemName', 'userId'],
|
|
},
|
|
uncheckedItem: {
|
|
matchingFields: ['boardId', 'checklistItemName', 'userId'],
|
|
},
|
|
addAttachment: {
|
|
matchingFields: ['boardId', 'userId'],
|
|
},
|
|
deleteAttachment: {
|
|
matchingFields: ['boardId', 'userId'],
|
|
},
|
|
addedLabel: {
|
|
matchingFields: ['boardId', 'labelId', 'userId'],
|
|
},
|
|
removedLabel: {
|
|
matchingFields: ['boardId', 'labelId', 'userId'],
|
|
},
|
|
// #2474: "a card's due/start/end/received date is set or changed" triggers.
|
|
// These activityTypes ('a-dueAt'/'a-startAt'/'a-endAt'/'a-receivedAt') are
|
|
// NOT new - models/cards.js's setDue/setStart/setEnd/setReceived already go
|
|
// through server/models/cards.js's Cards.before.update timing-field hook,
|
|
// which logs one of these activities (with timeKey/timeValue/timeOldValue)
|
|
// on every SET (the hook reads modifier.$set, so it only ever fires for a
|
|
// real value, never for unsetDue/unsetStart/unsetEnd/unsetReceived's
|
|
// $unset). Registering them here just wires the existing activity into the
|
|
// same TriggersDef-driven matcher every other trigger already uses - no new
|
|
// detection mechanism.
|
|
'a-receivedAt': {
|
|
matchingFields: ['boardId', 'userId'],
|
|
},
|
|
'a-startAt': {
|
|
matchingFields: ['boardId', 'userId'],
|
|
},
|
|
'a-dueAt': {
|
|
matchingFields: ['boardId', 'userId'],
|
|
},
|
|
'a-endAt': {
|
|
matchingFields: ['boardId', 'userId'],
|
|
},
|
|
};
|