mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
#4294 asked for four things. Several triggers and actions, rule variables, renaming in place and rule import/export were built earlier; two parts were still missing. - "I want the assignee to be the creator of the card by default": rules had member actions only. Add and Remove assignee actions take a username, a {creator}/{assignees}/{members} token, the user who triggered the rule, or "*" for every assignee, and write card.assignees. They are durable through Sync like the member actions, with the joinAssignee/unjoinAssignee activities the assignees hook writes. - "give a Rule a default name": Add Rule with an empty title showed an error, and rules.createRule stored the literal "Rule". The title is now optional; the rule is named after its trigger and action ("When ..., then ..."), and the rules list renames it in place. Fixing this found that "Remove all members from the card" iterated the card's assignees while removing from its members: an earlier fix believed assignMember wrote assignees, but both definitions in models/cards.js write members. It removed only members who were also assignees. Remove-all now iterates card.members, in the ordinary and the durable path, and the guards that pinned the wrong collection now read models/cards.js to decide. New text is added in English, pending Transifex. Thanks to xeruf and xet7 ! Fixes #4294.
29 lines
2.4 KiB
JavaScript
29 lines
2.4 KiB
JavaScript
// Shared rule presets for Workflow and Blocks. These use the existing engine.
|
|
export const TRIGGER_PALETTE = [
|
|
{ labelKey: 'r-w-card-created', doc: { activityType: 'createCard', listName: '*', swimlaneName: '*', cardTitle: '*', userId: '*' } },
|
|
{ labelKey: 'r-when-a-card-is-moved', doc: { activityType: 'moveCard', listName: '*', oldListName: '*', swimlaneName: '*', cardTitle: '*', userId: '*' } },
|
|
{ labelKey: 'r-w-card-archived', doc: { activityType: 'archivedCard', userId: '*' } },
|
|
{ labelKey: 'r-w-card-unarchived', doc: { activityType: 'restoredCard', userId: '*' } },
|
|
{ labelKey: 'r-w-label-added', doc: { activityType: 'addedLabel', labelId: '*', userId: '*' } },
|
|
{ labelKey: 'r-w-label-removed', doc: { activityType: 'removedLabel', labelId: '*', userId: '*' } },
|
|
{ labelKey: 'r-w-member-added', doc: { activityType: 'joinMember', username: '*', userId: '*' } },
|
|
{ labelKey: 'r-w-member-removed', doc: { activityType: 'unjoinMember', username: '*', userId: '*' } },
|
|
{ labelKey: 'r-w-assignee-added', doc: { activityType: 'joinAssignee', username: '*', userId: '*' } },
|
|
{ labelKey: 'r-w-assignee-removed', doc: { activityType: 'unjoinAssignee', username: '*', userId: '*' } },
|
|
{ labelKey: 'r-w-checklist-added', doc: { activityType: 'addChecklist', checklistName: '*', userId: '*' } },
|
|
{ labelKey: 'r-w-attachment-added', doc: { activityType: 'addAttachment', userId: '*' } },
|
|
{ labelKey: 'r-w-every-day-at', labelParams: { time: '09:00' }, doc: { activityType: 'scheduledTrigger', scheduleKind: 'calendar', scheduleType: 'daily', atTime: '09:00', listName: '*', swimlaneName: '*' } },
|
|
];
|
|
|
|
export const ACTION_PALETTE = [
|
|
{ labelKey: 'r-d-move-to-top-gen', doc: { actionType: 'moveCardToTop', listName: '*', swimlaneName: '*' } },
|
|
{ labelKey: 'r-d-move-to-bottom-gen', doc: { actionType: 'moveCardToBottom', listName: '*', swimlaneName: '*' } },
|
|
{ labelKey: 'r-d-archive', doc: { actionType: 'archive' } },
|
|
{ labelKey: 'r-d-unarchive', doc: { actionType: 'unarchive' } },
|
|
{ labelKey: 'r-mark-complete', doc: { actionType: 'markCardComplete' } },
|
|
{ labelKey: 'r-mark-incomplete', doc: { actionType: 'markCardIncomplete' } },
|
|
{ labelKey: 'r-remove-all', doc: { actionType: 'removeMember', username: '*' } },
|
|
{ labelKey: 'r-remove-all-assignees', doc: { actionType: 'removeAssignee', username: '*' } },
|
|
{ labelKey: 'r-w-set-received-now', doc: { actionType: 'setDate', dateField: 'receivedAt' } },
|
|
];
|