Commit Graph
7 Commits
Author SHA1 Message Date
Lauri Ojansivu f735eba194 Rules: assignee actions, an optional title, and remove-all members that removes them.
#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.
2026-10-08 11:31:12 +03:00
Lauri Ojansivu 59b1b0d8ae Follow the rule-variable change in three rule guards.
a91855993 routed member usernames through ruleUsernames() and the email
recipient through recipientVars(). ruleEmailFailure runs RulesHelper in a
VM with each free name injected, so the missing recipientVars made the
email path throw and the test wait forever; it now injects an identity
recipientVars. Two guards pinned the literal
getUser({ username: action.username }) line; a literal username is still
looked up unchanged, so they now pin the per-username lookup and keep
their defensive-resolution and crash-pattern assertions.

Thanks to xet7 !
2026-09-29 14:09:41 +03:00
Lauri Ojansivu 21cb6e8c86 Isolate shared rule components when editing automation rules
Copy changed shared triggers and actions while preserving unshared IDs and REST patch semantics. History restores component references and cleans unreferenced private copies.

Thanks to xet7 !
2026-09-27 20:24:42 +03:00
Lauri Ojansivu 6f79e87914 Add the missing acting-user module and UI button for rule "add member" (#2522).
The "add member" rule action's acting-user option (issue #2522 - "add
whoever just moved the card as a member") landed on main missing its
shared module: server/rulesHelper.js and cardActions.js already import
RULE_ACTING_USER_SENTINEL/resolveActingUserId from
/models/lib/ruleActingUser, but that file was never committed, breaking
the import on main. It also landed without the actual UI button that
saves the sentinel action.

models/lib/ruleActingUser.js resolves "who triggered this rule" from
activity.userId - the exact same source buildRuleVars() already uses for
the {username} template variable (#3304/#3301) - so both call one shared
function instead of two implementations of the same concept.
cardActions.jade gets the missing trigger button, wired to the existing
js-add-actinguser-member-action handler in cardActions.js.

tests/ruleAddMemberActingUser.test.cjs pins the sentinel resolution, that
rulesHelper.js and buildRuleVars() both call the one shared resolver (with
a negative, whole-tree source-pattern check that no other file
re-implements the same activity.userId shape), that the ordinary
fixed-member path is unaffected, the client/jade wiring, and that every
locale file has a real (non-English-placeholder) translation of the new
label. tests/ruleRemoveMemberAction.test.cjs and
tests/rulesApiTriggerNormalize.test.cjs are updated for the addMember
block's new if/else shape around the sentinel check.

Thanks to arisjr and xet7 !

Closes #2522,
2026-09-10 20:46:04 +03:00
Lauri Ojansivu baa780331c Close the remaining IFTTT trigger report
The checklist, email, member-removal, and date-action failures have already been corrected. Mark the exact moved-from-list positive and move-into-list negative regressions as coverage for the remaining report so later rule changes cannot silently revive it.

Thanks to TiibCD and xet7 !

Fixes #1972,
2026-08-25 18:00:49 +03:00
Lauri Ojansivu b46eecf58b Fix the 20 node suites the && chain had been hiding.
The new runner ran all 260 suites for the first time: 20 failed. Four were real
defects in the app, the rest were guards pinning a spelling or a design that had
since changed - each of them written when it was true, and none of them run
since, because npm stopped the chain at the first failure.

The app fixes:

  * models/lib/themeAccents.js: accentOf('constructor') returned Object's
    constructor - a FUNCTION - because a plain lookup answers from
    Object.prototype. A board colour named after any prototype member would have
    written a function into a stylesheet. Only the map's own keys are themes now.
  * RTL: the dependency overlay and its connect handle each set a physical
    left/right AFTER the logical property, so the physical one won and both were
    pinned to the LTR side in an Arabic or Hebrew layout. The skip link, the
    avatar's account badge, the stats value column and the theme-category label
    were physical too. All logical now (inset-inline-*, text-align: start/end).

The guards, each corrected to what the code actually does now, with the reason:

  * addBoardTileHeight, publicationArgumentGuard: a fixed-size slice
    (jade + 3000, source + 1400) that a grown comment pushed the subject out of.
    Both now take the whole block they are about.
  * adminCheckboxStyle: the Grey Icons feature is gone; asserts its REMOVAL.
  * boardsVisibilitySettings: the separator count was pinned at 3; the site-theme
    picker group made it 4. Asserts the shape - one Save per section, none for
    the picker that applies immediately.
  * changelogFormat: "# Upcoming WeKan ® release" is a legitimate heading.
  * dbConformanceWiring: the log directory honours WEKAN_LOGDIR now.
  * domainTablePage: the default page is the app-wide 10, not 25.
  * ferretdbOplogGating: the exec runs under the CPU launcher.
  * leftMenu: peopleMenu takes the user (multitenancy option D).
  * loginEmailPanesMoved: the board-member restriction is two checkboxes in
    Organizations and Teams now; asserted there.
  * mobileAllBoardsFit: the bell and the avatar are two rules with variants.
  * narrowWindowLayout: the hamburger is the last button in the flow, not pinned.
  * rulesApiTriggerNormalize: #6491 made a missing matching field mean "any
    value", so the #2674 "can never match" case now matches - and removeMember
    iterates assignees, not members.
  * securityLog: the new-problems selector moved to models/lib/eventLogProblems.
  * tablePage: the Cards report renders the page the SERVER named.
  * tenantWiring: the site colour is read in two places; the autorun is the one.
  * themeAccents: see above - the guard was right, the code was not.
  * translationPane: the "no hand-written table" regex matched the +tablePage
    include it also requires.
  * uiDensity: admin table cells wrap in one td+th rule now.
  * rtl: the dir attribute comes from a helper, `!important` is not part of a
    value, and the scanner read CSS COMMENTS as declarations - the comment
    explaining why `left: 50%` needs no RTL variant was reported as a violation.

Thanks to xet7 !
2026-07-28 04:28:36 +03:00
Lauri Ojansivu 25d33cec36 Fix #2345 #2674 #574: rules card title filter, rules REST API, api docs;
Sandstorm username races.

- #2345: the Card Title Filter is now SAVED by every board trigger
  builder (a trigger doc missing the field could never satisfy the
  matcher's $in - those rules fired for nothing), SHOWN in the rule
  details, and ENFORCED for archive/restore triggers by resolving the
  title from the card when the activity lacks it; legacy field-less
  triggers keep matching; the filter popup prefills its current value.
- #2674: rules created via POST/PUT /api/boards/:boardId/rules never
  fired - missing matching fields are now normalized to '*' wildcards
  and trigger/action types validated; the addMember/removeMember rule
  actions no longer crash on unresolvable usernames or member-less
  cards and their writes are awaited. New docs/API/Rules.md (endpoints,
  matching fields, wildcard semantics, the exact two-rule
  add-on-move-to/remove-on-move-from workflow), linked from REST-API.md;
  api.py help now lists the rule commands with the same example.
- #574: Sandstorm unique-username generation probes case-insensitively
  (anchored, regex-escaped) and retries the next number when a
  concurrent insert wins the unique-index race, instead of aborting the
  login hook with E11000.

Tests: tests/rulesCardTitleFilter.test.cjs (12),
tests/rulesApiTriggerNormalize.test.cjs (19),
tests/sandstormUsername.test.cjs (11) - positive and negative cases.

Thanks to InfoSec812, sfahrenholz, mitar and xet7.
2026-07-17 03:36:50 +03:00