Files
wekan/docs/Features/Rules/Rules/Blocks.md
T
Lauri Ojansivu 7e1f9e89eb Docs: every feature topic in one folder under docs/Features, each with README.md as its main page.
- The General/ level is gone: its 109 files moved up into the folders of the
  same name, and its topic table is the "Shared topics" section of
  Features.md.
- Accessibility is one folder, docs/Features/Accessibility/, with the Admin
  Panel's accessibility page in it.
- Every folder's main page is README.md (110 X/X.md pages renamed with git mv,
  five merged with an existing README.md, 26 index pages added for folders
  that had none), so a folder opened on GitHub shows its page.
- The 73 "# Moved" forwarding pages are deleted, with the folders that held
  only them; every link that went to one goes to its final page.
- docs/Features/README.md has the website's "Features in WeKan" overview,
  each feature linking to its page here.

1,129 Markdown links in 262 files and 352 doc paths in code, tests, compose,
snap and release files follow. tests/docsFeaturesLayout.test.cjs fails when
General/ or a "# Moved" page comes back, a folder has no README.md, or a
relative link in the docs or README.md does not resolve.

Thanks to xet7 !
2026-11-24 20:02:06 +02:00

12 KiB

Blocks view for IFTTT Rules

What it is

Blocks is a view of the board's Rules page in which a rule is built by dragging a trigger block and an action block together, Scratch style, with Blockly. It edits the same rules as the List and Workflow views, as one trigger followed by one action. It is for board administrators, and it never runs generated code.

Read more

Dependency references

How to use it

  1. Open the board's right sidebar → Board Settings → Blocks (below Rules). You must be a board admin.
  2. Choose an existing rule in the rule picker, or click Add rule and type the New rule title.
  3. Drag a trigger and an action from the toolbox into the workspace and connect them: Connect one trigger to one action.
  4. Edit the blocks' fields. For advanced options use Edit trigger/action, the form editor.
  5. Click Save. The page says Rule saved, or Unsaved changes while there are edits; Reload saved rule throws a draft away.

Using Blocks

Open the board's right sidebar → Board Settings and select Blocks below Rules (the Rules page's own sidebar is gone; its views are listed there). Board Settings also provides direct List view, Workflow view and History choices. Board administrators can select an existing rule or create a new one, drag a trigger and action into the workspace, connect them, edit their supported fields and save. Use Edit trigger and action for advanced settings in the existing form editor. A workspace must contain exactly one connected trigger/action pair to save. Unknown stored parameters are retained rather than discarded.

The editor uses the current theme and writing direction, local media, zoom, panning, a trash area and Blockly context-menu editing. Language changes preserve the current draft. Per-block disabling and standalone workspace comments are not offered because the existing rule engine has no equivalent stored semantics; rule enabling remains in the existing rule controls. Blockly code generation is never used, and no script or XML from a workspace is executed.

How the numbers are calculated

The view has no numbers of its own. Its limits: a workspace must hold exactly one connected trigger and one action to save (models/lib/rulesBlocks.js); a rule's extra triggers and actions (at most ten of each, MAX_EXTRA_RULE_PARTS) are edited in Rule details. The installed Blockly is 13.4.0 (package.json); the translation test requires a WeKan key for every one of its catalog messages (701 now, tests/blocklyTranslations.test.cjs).

How it works in WeKan

Implementation plan

Add Blocks to the existing IFTTT Rules view controls alongside List and Workflow. Use Blockly's Scratch-style connections to represent the existing WeKan rule model: one trigger followed by one action. Keep Rules, Triggers and Actions as the authoritative data, and keep the existing automation engine.

  1. Load Blockly only when Blocks is opened. Use the maintained blockly npm package (Apache-2.0), not a CDN, script generator or external service.
  2. Provide a board-scoped rule picker and a new-rule workspace. Render existing trigger/action documents without discarding fields the editor does not know. Offer the existing Workflow trigger/action palette as draggable blocks.
  3. Let users connect a trigger and action, edit supported human-readable parameters and the rule title, then save explicitly. Keep advanced options accessible through the existing rule editor. Reject disconnected, extra or incomplete blocks rather than silently changing their meaning.
  4. Save through rules.createRule and rules.updateRule. Keep board-admin and cross-board destination checks on those existing server methods. Never execute generated JavaScript, Blockly XML, or arbitrary code.
  5. Dispose workspaces and resize observers on navigation. Preserve an unsaved draft while reactive data updates; ask before replacing it with another rule.
  6. Test adapter round trips, malformed workspaces, authorization, lazy loading, real Blockly editing, persistence and actual execution of a saved rule.

Files

Scope

When this view was added the engine supported one trigger and one action per rule. Since 2026-09-29 a rule may also have up to ten more triggers (any of them fires it) and ten more actions (run in order), added in Rule details with Add another trigger / Add another action (models/lib/ruleParts.js). The Blocks view still connects and saves the rule's own trigger and action pair. This view does not introduce multi-action chains, new condition semantics, loops, executable scripts, or Jira/ScriptRunner imports. Trigger filters remain part of the trigger document. The pasted Autoblocks discussion is UI inspiration, not a source of verified product history or a compatible import format.

Source comments and documentation are English. UI text uses WeKan translations. All Blockly catalog messages (696 when the view was added; 701 in the installed blockly 13.4.0) are mapped into WeKan locale files, including accessibility and programming-block terminology. Translation filling is paused for release at the maintainer's request; catalog completeness and placeholder tests do not establish linguistic accuracy or that every English placeholder has been translated. Existing List and Workflow views remain available. Rule storage and export formats remain unchanged; Blockly workspace state is an editing representation, not a second rule database.

History and permissions

A combined rule edit records its title, enabled state, trigger and action as one entry in the existing board History. Creation, deletion, enable changes, form edits, Workflow saves and Blocks saves use the same history. Choose History under Rules in Board Settings to view or restore rule versions. Undo/redo also supports these entries and refuses to overwrite an intervening edit.

REST rule creation, edits and deletion also record one attributed entry per compound operation. Unchanged requests record none. If legacy/imported rules share a trigger or action, editing a component isolates it for the edited rule, and deletion retains components still referenced elsewhere. Undo/redo restores the references without overwriting changed shared content. Trigger changes also restore the matching manual-button menu metadata. These operations are not multi-document transactions; concurrent-write recovery remains additional work.

Restoring a rule requires board-administrator permission, just like editing it. An action targeting another board also requires current write access to that destination. History is not a way to regain revoked permissions. Server-side validation is authoritative even when a browser hides a control.

Verification and remaining work

Node tests use real Blockly workspaces to verify serialization and unknown-field preservation, reject invalid connections and check lazy-loading boundaries. Chromium tests exercise drag/drop, field editing, persistence, rule execution, permissions, localized context menus, RTL, themes and narrow screens. History tests exercise compound snapshots, undo/redo, restore and intervening-edit conflicts. Translation tests cover all locale catalogs and token inventories; minority-language specialist terminology still needs native review.

Verification checkpoint (2026-09-27): after the REST History, shared-component and button-metadata fixes, the combined rules-blocks.e2e.js, rules-history.e2e.js and rules-visibility.e2e.js run passes all 18 Chromium scenarios against the local Meteor/MongoDB application. This includes real Blockly edits and rule execution, administrator restrictions, Finnish and Arabic editing, undo/redo and restoration, REST writes, shared records, manual-button visibility and layout at 390px/1440px in Belize, Dark and Cleanlight themes.

A broader selection of 37 rule/workflow-related Node files passes 45 runner checks; the separate Blockly catalog suite passes three checks without changing translations. Firefox, WebKit and FerretDB were not exercised in this checkpoint. These results do not establish full translation or transactional concurrent History writes; the concurrency limits still apply.

Translation progress

Blockly translation work is paused again by request on 2026-09-27 for release. Resume only when requested. Gujarati now has translations for all audited Blockly prose and r-blocks-* editor messages. Tests explicitly allow unchanged printed key names, platform brands, OK, mathematical notation, URLs and nonlinguistic symbols. This is placeholder coverage, not native-speaker verification; specialist terminology still needs review. Chromium coverage exercises Gujarati block dragging, field editing, saving and context menus. The editor remains available; remaining languages and native terminology review were tracked under TODO Later in the changelog, which moved to TODO.md on 2026-11-18; that file has no Blockly entry now. Message coverage and placeholder checks do not imply complete translation.

Commits