Compare commits

...
88 Commits
Author SHA1 Message Date
github-actions[bot] 7ba10de7ca Bump versions for v13.40 2026-12-02 19:04:21 +00:00
Lauri Ojansivu 529b56070c Prepare v13.40 release 2026-12-02 21:03:06 +02:00
Lauri Ojansivu b901eabbe8 Record the Univention App Center startup fix 2026-12-02 21:00:48 +02:00
Lauri Ojansivu 2c3c341a24 Merge remote-tracking branch 'origin/main' 2026-12-02 20:57:23 +02:00
Lauri Ojansivu a7b9cb757d Prepare UCS releases from Node-based migration hooks 2026-12-02 20:53:41 +02:00
Lauri Ojansivu b85a1b4c3f Record Jira Start date write-back warning 2026-12-02 20:50:05 +02:00
Lauri Ojansivu 669c999108 Keep independent Jira edits when Start date is unavailable 2026-12-02 20:49:42 +02:00
Lauri Ojansivu d4781f7109 Record Jira List Sync start date write-back 2026-12-02 20:46:40 +02:00
Lauri Ojansivu ede3a6a465 Write Jira start dates back through the mapped editable field 2026-12-02 20:46:24 +02:00
Lauri Ojansivu 2757420911 Record Jira List Sync start dates 2026-12-02 20:42:42 +02:00
Lauri Ojansivu 1ad00a9bf4 Read a uniquely named Jira Start date in List Sync 2026-12-02 20:42:30 +02:00
Lauri Ojansivu 1650585dba Record OpenProject budget write-back 2026-12-02 20:38:42 +02:00
Lauri Ojansivu eaabe86b91 Sync OpenProject budget changes back through the edit form 2026-12-02 20:38:27 +02:00
Lauri Ojansivu e9b5d3b7bd Record OpenProject budget API exports 2026-12-02 20:34:45 +02:00
Lauri Ojansivu d86f2be606 Match OpenProject budgets during work package API export 2026-12-02 20:34:19 +02:00
Lauri Ojansivu ec4b501fc1 Record targeted Firefox rerun results 2026-12-02 20:29:01 +02:00
Lauri Ojansivu b02cd66e94 Wait for per-user checklist refusal audit counts in Playwright 2026-12-02 20:28:46 +02:00
Lauri Ojansivu 8b72c4ad3e Record Jira Cloud description panel support 2026-12-02 20:24:16 +02:00
Lauri Ojansivu ffcb88bda2 Preserve Jira Cloud panels in card descriptions 2026-12-02 20:24:00 +02:00
Lauri Ojansivu 410c90f2e1 Record Jira Data Center panel API exports 2026-12-02 20:17:54 +02:00
Lauri Ojansivu f7d3e8b76f Preserve Jira Data Center panels in direct API export 2026-12-02 20:17:24 +02:00
Lauri Ojansivu 5ac5ebcab2 Record Jira Data Center panel write-back 2026-12-02 20:14:12 +02:00
Lauri Ojansivu 6a2e20d533 Preserve Jira Data Center panels during description write-back 2026-12-02 20:13:59 +02:00
Lauri Ojansivu c557f3f4a7 Record Jira API inline formatting preservation 2026-12-02 20:10:46 +02:00
Lauri Ojansivu a06ac78eed Preserve inline formatting in Jira API description exports 2026-12-02 20:10:33 +02:00
Lauri Ojansivu 790e908c60 Record OpenProject work package type write-back 2026-12-02 20:07:08 +02:00
Lauri Ojansivu 3d99f32903 Sync compatible work package type changes back to OpenProject 2026-12-02 20:06:32 +02:00
Lauri Ojansivu 48af3c2a6f Record OpenProject milestone date sync fix 2026-12-02 20:02:59 +02:00
Lauri Ojansivu 69b84e5bf4 Clear synchronized start dates when OpenProject changes to a milestone 2026-12-02 20:02:45 +02:00
Lauri Ojansivu a6e34b542f Record OpenProject milestone date exports 2026-12-02 19:59:42 +02:00
Lauri Ojansivu 07a252412d Export OpenProject milestone dates through the work package form 2026-12-02 19:59:31 +02:00
Lauri Ojansivu 6103a408c1 Record OpenProject import People selection 2026-12-02 19:56:26 +02:00
Lauri Ojansivu bfa76c0336 Respect the People selection in OpenProject board imports 2026-12-02 19:56:15 +02:00
Lauri Ojansivu f903383297 Record OpenProject assignment imports 2026-12-02 19:53:40 +02:00
Lauri Ojansivu 8811a8e859 Preserve mapped OpenProject assignees on imported cards 2026-12-02 19:53:28 +02:00
Lauri Ojansivu 53d10dc427 Record OpenProject card assignee exports 2026-12-02 19:46:51 +02:00
Lauri Ojansivu 7269c2767f Export unambiguous card assignees to OpenProject
Use the destination project create schema to match one eligible user. Respect export anonymization and leave ambiguous assignments empty.
2026-12-02 19:46:20 +02:00
Lauri Ojansivu fb36e4af5f Record multiple OpenProject target version exports 2026-12-02 19:41:08 +02:00
Lauri Ojansivu a2923a6591 Export multiple OpenProject target versions when the form confirms them 2026-12-02 19:40:57 +02:00
Lauri Ojansivu 3ca49dcbb2 Record OpenProject work package label exports 2026-12-02 19:38:04 +02:00
Lauri Ojansivu 0e844410a2 Export OpenProject work package labels from the destination workspace catalog 2026-12-02 19:37:51 +02:00
Lauri Ojansivu a854ce91dc Record OpenProject category and project phase exports 2026-12-02 19:30:29 +02:00
Lauri Ojansivu ff42e16e37 Export OpenProject categories and project phases from card labels 2026-12-02 19:30:17 +02:00
Lauri Ojansivu a4cde50edc Record OpenProject version exports in the upcoming changelog 2026-12-02 19:27:23 +02:00
Lauri Ojansivu b5415e4d7d Export OpenProject target and observed versions from card labels 2026-12-02 19:27:07 +02:00
Lauri Ojansivu f0a11a9574 Record OpenProject story point exports 2026-12-02 19:21:05 +02:00
Lauri Ojansivu 3ae484014c Export OpenProject story points from mapped card fields 2026-12-02 19:20:54 +02:00
Lauri Ojansivu 2a3ebcb9ff Record the additional Jira macro options in the upcoming changelog 2026-12-02 19:17:39 +02:00
Lauri Ojansivu af7082e359 Keep Jira macro language, colors and border width in write-back 2026-12-02 19:17:26 +02:00
Lauri Ojansivu 3f36b49079 Record Jira Data Center macro option preservation 2026-12-02 19:15:11 +02:00
Lauri Ojansivu b6ce696029 Preserve Jira Data Center code macro options in write-back 2026-12-02 19:14:59 +02:00
Lauri Ojansivu 6eca89ae2f Move Jira disclosure media support to the upcoming changelog 2026-12-02 19:10:49 +02:00
Lauri Ojansivu 36179889f9 Preserve Jira Cloud disclosure media during description write-back 2026-12-02 19:10:35 +02:00
Lauri Ojansivu ea8836080d Move Notion rollup resumption to the upcoming changelog 2026-12-02 19:06:36 +02:00
Lauri Ojansivu 1fcdeeb60f Resume Notion external rollup verification across List Sync runs 2026-12-02 19:06:22 +02:00
Lauri Ojansivu e7a2a4a583 Record the larger Notion List Sync Markdown limit 2026-12-02 19:01:26 +02:00
Lauri Ojansivu 79d1706893 Allow up to six MiB of Markdown per Notion List Sync page 2026-12-02 19:01:13 +02:00
Lauri Ojansivu 802493d76c Record the larger Notion Markdown import limit 2026-12-02 18:58:03 +02:00
Lauri Ojansivu 9a09e792a9 Import larger assembled Notion Markdown pages 2026-12-02 18:57:50 +02:00
Lauri Ojansivu 96d8b7cf3f Record larger Notion checkpoints and update the remaining limits 2026-12-02 18:53:50 +02:00
Lauri Ojansivu 56ad2221a9 Resume larger Notion bulk imports without creating partial boards 2026-12-02 18:53:36 +02:00
Lauri Ojansivu 4c6bb7d36b Move deeper Jira hierarchy export to the upcoming changelog 2026-12-02 18:49:52 +02:00
Lauri Ojansivu e6db086827 Preserve deeper Jira Cloud issue hierarchies in exports 2026-12-02 18:49:39 +02:00
Lauri Ojansivu 9ce539e498 Record three-level Jira Cloud exports and remaining verification 2026-12-02 18:46:28 +02:00
Lauri Ojansivu 5a92400d37 Preserve three-level Jira Cloud export hierarchies when supported 2026-12-02 18:46:15 +02:00
Lauri Ojansivu fce538085b Record OpenProject work package type exports 2026-12-02 18:41:45 +02:00
Lauri Ojansivu de92f4006f Preserve the OpenProject work package type in API exports 2026-12-02 18:41:33 +02:00
Lauri Ojansivu a918c65288 Record OpenProject status and priority exports 2026-12-02 18:38:30 +02:00
Lauri Ojansivu 150f26e6af Export OpenProject status and priority by destination name 2026-12-02 18:38:19 +02:00
Lauri Ojansivu e2329da283 Move OpenProject automatic scheduling to the upcoming changelog 2026-12-02 18:35:23 +02:00
Lauri Ojansivu ddcd0339c5 Restore OpenProject automatic scheduling after exporting relationships 2026-12-02 18:35:08 +02:00
Lauri Ojansivu 38ad008f1d Record OpenProject scheduling exports and the remaining work 2026-12-02 18:31:50 +02:00
Lauri Ojansivu 7b1a65c40a Export OpenProject work package scheduling fields 2026-12-02 18:31:35 +02:00
Lauri Ojansivu c1368dcdd3 Record the Apple Glass Pastel contrast fix 2026-12-02 18:27:53 +02:00
Lauri Ojansivu 90c0ec8736 Improve Apple Glass Pastel card control contrast 2026-12-02 18:27:42 +02:00
Lauri Ojansivu 8b6d287f66 Reopen the Scrum backlog through the view menu in its browser test 2026-12-02 18:25:07 +02:00
Lauri Ojansivu caffa08a55 Expect Jira Data Center bearer authentication in sync tests 2026-12-02 18:23:23 +02:00
Lauri Ojansivu e241d30604 Configure local SMTP for single-spec Playwright runs 2026-12-02 18:21:52 +02:00
Lauri Ojansivu b80e496631 Check Date settings alignment with the shared checkbox style 2026-12-02 18:20:04 +02:00
Lauri Ojansivu 5561658ac2 Wait for card settings to render before testing field drag 2026-12-02 18:15:05 +02:00
Lauri Ojansivu 92b0291bda Record the Board View help layout fix 2026-12-02 18:11:33 +02:00
Lauri Ojansivu 240a87e9cf Keep Board View help beside its menu when the header wraps 2026-12-02 18:11:22 +02:00
Lauri Ojansivu e7545fedda Record the board label fix in the upcoming changelog 2026-12-02 18:08:27 +02:00
Lauri Ojansivu 744b7fed03 Save new board labels with the server-side duplicate check 2026-12-02 18:08:13 +02:00
Lauri Ojansivu ac3f424028 Enable frame protection in Playwright server startup 2026-12-02 18:02:56 +02:00
Lauri Ojansivu 4b88117c6b Record the native import fixes and full Firefox verification status 2026-12-02 18:01:42 +02:00
Lauri Ojansivu 06e17c935b Preserve required list fields in native WeKan imports 2026-12-02 18:01:25 +02:00
Lauri Ojansivu 3522c10d2b Account for Notion and Planka Sync metadata in native imports 2026-12-02 17:59:08 +02:00
86 changed files with 2815 additions and 600 deletions

No files matched your search

+339 -317
View File
@@ -97,6 +97,345 @@ Which databases WeKan supports
</details>
# v13.40 2026-12-02 WeKan ® release
**In short:** Native **WeKan board imports** preserve required list fields
and handle **Notion** and **Planka** synchronization metadata. Multiline
board labels save correctly. **OpenProject** transfers preserve assignees and
milestone dates and budgets. List Sync can write back compatible type
changes and budget choices.
**Jira** transfers retain description panels and API exports preserve inline
formatting. List Sync can also read and update Jira start dates. The
**Univention App Center** package starts with the shell-free WeKan image.
This release fixes the following issues:
<details>
<summary><a href="https://github.com/wekan/wekan/commit/06e17c935b677a055a886ac62b0d5f50788571ef">Preserve required list fields in native WeKan imports</a>. Thanks to xet7.</summary>
Required dates carry over directly. Custom-field requirements follow the
new field IDs on the imported board.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/3522c10d2b0f25e2e2780757f67dfc27528f669b">Check which Notion and Planka Sync data stays out of native imports</a>. Thanks to xet7.</summary>
Native board imports keep user data and leave behind the synchronization
metadata that tracks ownership and write-back on the source board.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/744b7fed03e3693ed47b793207d8c0fa10402569">Save new board labels with the server-side duplicate check</a>. Thanks to xet7.</summary>
Creating a label from the card popup preserves line breaks in the name.
The board label update checks for duplicates on the server.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/240a87e9cf1abf1cfaccdb7ce1adab6f8c3c44cc">Keep Board View help beside its menu when the header wraps</a>. Thanks to xet7.</summary>
The help button wraps with the Board View menu and follows the language's
reading direction.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/90c0ec8736345af9488582f99f12aeffe720a917">Improve Apple Glass Pastel card control contrast</a>. Thanks to xet7.</summary>
Primary buttons use a darker blue and a softer highlight. The add-reminder
icon uses dark blue on a light background.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/7b1a65c40aa44d9d6ea9e388d9e0d7acc9cc5aa0">Export OpenProject work package scheduling fields</a>. Thanks to xet7.</summary>
Card and list exports send the mapped scheduling duration and non-working
day setting when the destination allows them. When both calendar dates are
present, OpenProject calculates the duration.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/ddcd0339c5897024f61d90bcc47885567918bc0a">Restore OpenProject automatic scheduling after exporting relationships</a>. Thanks to xet7.</summary>
WeKan restores automatic scheduling after creating the work packages and
their relationships, when the destination accepts the scheduling change.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/150f26e6afc1fd4d07bf676a5e14fc642fe980d4">Export OpenProject status and priority by destination name</a>. Thanks to xet7.</summary>
Card and list exports match imported status and priority names against the
destination's inline allowed values. Unknown or ambiguous values are skipped.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/de92f4006f517843dc14e6e525ba72eeb2f2c668">Preserve the OpenProject work package type in API exports</a>. Thanks to xet7.</summary>
Card and list exports match the imported work package type by name and
check the remaining mapped fields against that type's creation schema.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/5a92400d379163d961d6a96bf5724729fb7fddcc">Preserve three-level Jira Cloud export hierarchies when supported</a>. Thanks to xet7.</summary>
Jira Cloud exports preserve an epic, its issues and their subtasks when
project metadata identifies a single eligible epic type and allows setting
the parent on the selected issue type.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/e6db086827b6ae2fb192ae34125b4157029f6230">Preserve deeper Jira Cloud issue hierarchies in exports</a>. Thanks to xet7.</summary>
Exports include parent levels above epics when project metadata provides a
unique creatable type at every level and allows the required parent links.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/56ad2221a9c3cbe93243807781719c51490ba6b5">Resume larger Notion bulk imports without creating partial boards</a>. Thanks to xet7.</summary>
Notion bulk imports can resume with up to 256 MiB of decoded checkpoint
data and 64 MiB after compression and storage encoding. An incomplete
import that cannot save a checkpoint reports the size limit.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/9a09e792a932dbae1deefb172786335c8e85a468">Import larger assembled Notion Markdown pages</a>. Thanks to xet7.</summary>
One-time Notion API imports can assemble and store pages with up to 7 MiB
of Markdown. List Sync uses a 5 MiB limit because it also stores the
source value for conflict detection.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/79d170689326688128fc6294d2b40334454a1936">Allow up to six MiB of Markdown per Notion List Sync page</a>. Thanks to xet7.</summary>
Notion List Sync can assemble up to 6 MiB of Markdown per page across
runs, with room in the card document for the conflict-detection baseline.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/1fcdeeb60fb17b914be62280f2137ce032fb7577">Resume Notion external rollup verification across List Sync runs</a>. Thanks to xet7.</summary>
Notion List Sync checkpoints external rollup lookups so a later run can
finish verifying dependencies that exceed the 25-page lookup budget.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/36179889f9ea1b790c9ed5ca987dbecf8610fc2b">Preserve Jira Cloud disclosure media during description write-back</a>. Thanks to xet7.</summary>
Card descriptions display references to Jira media in expandable sections.
Text edits can be written back while preserving the original media blocks.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/b6ce696029a95fc3a21fde5aa8c54f2ce6db5c2e">Preserve Jira Data Center code macro options in write-back</a>. Thanks to xet7.</summary>
Description write-back preserves titles and supported border styles in
code and noformat blocks, including blocks inside quotes.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/af7082e359abd80f5172b36118e991e3c5957900">Keep Jira macro language, colors and border width in write-back</a>. Thanks to xet7.</summary>
Jira Data Center code and noformat blocks retain their language, supported
colors and border width when descriptions are written back.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/3ae484014c196858f4fc571abfde1373375b42b6">Export OpenProject story points from mapped card fields</a>. Thanks to xet7.</summary>
Card and list exports send the mapped story point estimate, including zero,
when the destination work package type allows it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/b5415e4d7d4b78fd97480822e9b56ff80b1d6699">Export OpenProject target and observed versions from card labels</a>. Thanks to xet7.</summary>
With Labels selected, card and list exports match imported version labels
against the destination's allowed values. The target version also works
with servers that expose only the older single-version field.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/ff42e16e37049a13dcacb92b24fbddd044015f48">Export OpenProject categories and project phases from card labels</a>. Thanks to xet7.</summary>
Card and list exports match imported category and project phase labels
against the destination's allowed values.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/0e844410a27fc1edcd0bba1a6ffd50ccbd76475b">Export OpenProject work package labels from the destination workspace catalog</a>. Thanks to xet7.</summary>
Card and list exports match imported work package labels by name, including
when the destination supplies its allowed labels as a paginated collection.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/a2923a65915dffcb9c7f2f336cdcf254c9a8a7cc">Export multiple OpenProject target versions when the form confirms them</a>. Thanks to xet7.</summary>
The export saves multiple mapped target versions when the destination's
creation form confirms the full selection.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/7269c2767f95e40364c137d6abf0d5afe7f2b26e">Export card assignees to OpenProject</a>. Thanks to xet7.</summary>
With People selected, a card with one assignee can keep that assignment
when exactly one eligible OpenProject user has the matching name.
Export anonymization suppresses assignments.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/8811a8e8598f685fdf313fc414af10ef7b772947">Preserve mapped assignees when importing OpenProject work packages</a>. Thanks to xet7.</summary>
With People selected, mapped OpenProject assignees appear in the WeKan
card's assignee field and can be exported back through the API.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/bfa76c03361615c839e7ae26ac0ea63a8620b4c2">Honor the People selection in OpenProject board imports</a>. Thanks to xet7.</summary>
With People unchecked, imported work packages omit their assignee,
responsible person, author and watchers.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/07a252412d7447f7b3133b9442ad86f8c820e6eb">Export OpenProject milestone dates</a>. Thanks to xet7.</summary>
With Dates and Custom Fields selected, a milestone card's due date becomes
the milestone date when the destination type exposes a writable date field.
The export reports unsupported milestone fields as skipped.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/69b84e5bf4029d70f704a265a5929dda92ed71eb">Clear synchronized start dates when OpenProject changes to a milestone</a>. Thanks to xet7.</summary>
With Start Date selected, List Sync clears the old start date when the
source work package becomes a milestone. The milestone date syncs as the
card's due date when Due Date is selected.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/3d99f32903149a26835426e6b8ba63e74706af58">Write back OpenProject work package type changes from List Sync</a>. Thanks to xet7.</summary>
With Type and Write Back selected on an unfiltered list, a change to the
mapped text field updates the work package type when OpenProject's
versioned form confirms the change. The type must keep its milestone
or regular work package date fields.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/a06ac78eedb650bc8906ed5673a769570605e38e">Preserve inline formatting in Jira API description exports</a>. Thanks to xet7.</summary>
Card descriptions retain underlines, subscripts and superscripts when
exported to Jira Cloud and Data Center. Data Center exports also preserve
citations.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/6a2e20d533563fb9825df951ad08a859b09eb043">Preserve Jira Data Center panels during description write-back</a>. Thanks to xet7.</summary>
List Sync can write back edits inside a panel while preserving its
validated options and nested code or noformat blocks.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/f7d3e8b76fcfde9bea06cb69e0e0089b4dbcf065">Preserve Jira Data Center panels in direct API export</a>. Thanks to xet7.</summary>
Card descriptions retain their panels and the supported formatting inside
them when exported directly to Jira Data Center.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/ffcb88bda267c0661701310e16aa6fd798e25208">Preserve Jira Cloud panels in card descriptions</a>. Thanks to xet7.</summary>
Imported panels are visible on the card. API export and List Sync can
reconstruct their type and supported formatted content.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/b02cd66e94e41b08a5854af4d2b79fa3fb96ad1b">Check checklist refusal audit counts in Playwright</a>. Thanks to xet7.</summary>
The test waits for the affected user's audit counts for checklist and
checklist item refusals.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/d86f2be606345c87d69dcd86d76fdff2e0ae3650">Match OpenProject budgets during API export</a>. Thanks to xet7.</summary>
With Custom Fields selected, the export matches the card's budget name
against the destination project's writable budget choices. Ambiguous or
unavailable choices are reported as skipped.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/eaabe86b916c269e9735219270af0f529fadf3d2">Write back OpenProject budget changes in List Sync</a>. Thanks to xet7.</summary>
With Budget and Write Back selected on an unfiltered list, a change to the
mapped field updates or clears the work package budget if its current edit
form allows the operation.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/1ad00a9bf45df3e53246e881fc34309d273aac26">Read Jira start dates in List Sync</a>. Thanks to xet7.</summary>
With Start Date selected, Jira Cloud and Data Center lists can read a
uniquely named Start date field. A cleared field removes the card date,
while a missing field leaves it in place.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/ede3a6a4653ba620c2e65036ad33dc88387c35c7">Write back Jira start dates in List Sync</a>. Thanks to xet7.</summary>
With Start Date and Write Back selected, edits or clears can be sent to
the mapped Jira date field after checking the field's edit metadata and
the most recent source value.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/669c999108058054535fb3d78b2280a0a03c9e2a">Keep Jira List Sync edits when Start date is unavailable</a>. Thanks to xet7.</summary>
Other fields can still sync when Jira does not allow an edit to the Start
date. List Sync reports the skipped date in its write-back warning.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/a7b9cb757d150331270bc5fb5ced483b0dc3beba">Prepare Univention App Center releases for the shell-free WeKan image</a>. Thanks to the Univention App Center team and xet7.</summary>
Compose starts WeKan with Node after checking the UCS migration marker.
The installation hook uses the migration helper bundled in the WeKan
image. See the [Compose and installation hook changes](https://github.com/wekan/univention/commit/aa1636b3682c2fbb82b8b332957dc066d5a36a14)
in the Univention repository.
</details>
# v13.39 2026-12-02 WeKan ® release
**In short:** The export menu sends selected WeKan cards to a chosen **Jira**
@@ -8516,320 +8855,3 @@ published on their own and excluded; the cards themselves are not changed.
</details>
Thanks to above GitHub users for their contributions and translators for their translations.
# v13.16 2026-11-19 WeKan ® release
**In short:** **ListLockBulkBleed** is fixed, and a list that refuses a role
now also refuses that role's bulk writes, dependency lines, rule actions and
changes to the list or swimlane itself. Administrators can give chosen users,
teams and organizations a smaller WeKan with opt-in **feature profiles**. A
server no longer runs out of memory in the hourly **History integrity audit**,
**scheduled rules** can create cards again, and **Card Excel export** and
clearing a card's text work again.
This release fixes the following CRITICAL SECURITY ISSUE of [ListLockBulkBleed](https://wekan.fi/hall-of-fame/listlockbulkbleed/):
<details>
<summary><a href="https://github.com/wekan/wekan/commit/ba3d94390ba724344a2d5cfe50e9dee3cc6f8d89">Bulk REST card writes and server-side card writes ask the list's role exception</a>. Thanks to immanuwell and xet7.</summary>
[GHSA-83w9-74mx-7v83](https://github.com/wekan/wekan/security/advisories/GHSA-83w9-74mx-7v83),
CWE-863. A board admin can refuse a role write access in one list (#4527).
`DELETE /api/boards/:boardId/cards/bulk` and
`POST /api/boards/:boardId/cards/labels` take their cards from the body, so no
URL names a list, and asked only for board write access; the methods
`archiveSelectedCards`, `copyCard` and `createLinkedCard` write from server
code, past the Cards allow/deny rules. A normal member the list refused could
permanently delete its cards in one request, relabel and archive them, and copy
or link new cards into it.
The bulk routes now read every card and ask each list before the first write:
any refusal is a 403 and nothing changes, and each removal and relabel is keyed
on the list that was checked. The refusal shows in Admin Panel / Problems as
ListLockBulkBleed (`authz.list-locked-bulk`, medium, never disables). The
methods answer `not-authorized` and are not recorded, because Copy Card and
Multi-Selection reach them in ordinary use. The same shape was fixed in twelve
more paths: converting a card to a board, adding a subtask,
`createCardWithDueDate`, the iCalendar import, sending and receiving board
email, creating a version-control issue, moving board objects, History and
position-history undo and redo, renaming an attachment, the scoped import and a
card's rule button. Dependency lines keep their own board-wide rule.
`tests/listLockBulkBleed.test.cjs` runs the gate on the reporter's board and
pins every path; `tests/playwright/specs/list-lock-bulk.e2e.js` replays the
proof of concept.
</details>
and adds the following new feature:
<details>
<summary><a href="https://github.com/wekan/wekan/commit/fc21b0b177dc8f8902efa39d0f89c8b041c7cf2d">Feature profiles hide features from the users, teams and organizations an administrator chooses</a>. Thanks to mimZD and xet7.</summary>
[#6837](https://github.com/wekan/wekan/issues/6837): Admin Panel / Settings /
Visibility / Features gains feature profiles - a name, the optional features it
hides, and the users, teams and organizations it applies to. It is strictly
opt-in: a user with no profile sees everything, a profile only hides and changes
no data or permission, and the member menu tells the user which profile hides
how many features, so nothing looks missing. Every place that hides a disabled
feature follows it. The new strings are in every language.
`tests/featureProfiles.test.cjs` and `feature-profiles.e2e.js` cover it.
</details>
and fixes the following bugs:
**Per-list role exceptions** - what else a list that refuses a role refuses,
as decided after ListLockBulkBleed.
<details>
<summary><a href="https://github.com/wekan/wekan/commit/da6d9d39b8bd209006fc02fe735f1c277a2be693">Dependency lines follow the card's list</a>. Thanks to xet7.</summary>
A dependency line is stored on its source card, but it followed only the
board-wide dependency rule, so a role a list refused could still add, change and
remove lines on that list's cards. Now the methods answer `not-authorized`, the
REST dependency routes answer 403 recorded as ListLockBleed, and the import
skips such lines; board and site admins are not restricted.
`tests/listLockDependencies.test.cjs` and `tests/listPermissions.test.cjs` pin
it, and `list-lock-bulk.e2e.js` replays it over REST.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/3202a1d7ac1027b41af5a5dfbe03893ccbc89c36">Deleting, archiving or moving a list or swimlane follows the list</a>. Thanks to xet7.</summary>
These do the same to the cards in them, yet were gated by board write access
alone. A list that refuses a role now also refuses that role deleting,
restoring, archiving or moving it, and deleting, archiving or moving a swimlane
holding its cards - on DDP, REST (403, recorded as ListLockBleed) and client
writes alike. The list menu no longer offers its archive actions there.
Renaming and reordering stay allowed, and board admins are never restricted.
`tests/listLockStructure.test.cjs` pins it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/ee24453dcb5d9ed8af5c07b848cbd5bd8979ae28">A rule action into a refusing list is skipped, and the rest of the rule runs</a>. Thanks to xet7.</summary>
A rule's move, archive, create-card, copy, link and list actions checked only
board write access. Each now asks the lists it writes in as the user who
triggered the rule; a refusing list skips that action and shows in Admin Panel /
Problems as ListLockRule (detected, low), since a rule meeting a locked list is
not an attack. `tests/listLockRules.test.cjs` pins it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/a0f36819610e6d0aa9c170340f8421c1b7fc2bbe">List Sync's rule replay skips such an action too</a>. Thanks to xet7.</summary>
The journaled List Sync replay still wrote with board write access only. Each of
its list-writing runners now decides before saving its command, records a
durable skip and lets the rest of the plan run; a replay reads the saved skip,
so it never re-decides and never skips a half-finished action.
`tests/listSyncRuleListSkip.test.cjs` pins it.
</details>
**Server memory and timed jobs** - what runs on its own, every hour.
<details>
<summary><a href="https://github.com/wekan/wekan/commit/cfd9a62466a64b58d514d46c3c6560f003704523">Swap alone is not high RAM usage, and resource monitors are not named like vulnerabilities</a>. Thanks to xet7.</summary>
A laptop with many programs open showed "RamBleed, high: high RAM usage started
(>= 90%)" at RAM 52% and swap 60%: swap at 25% started a period by itself. Swap
now counts only while RAM is also tight, the row says what started it, and only
RAM near full is high severity. The RAM, CPU, disk and speed rows are named for
what happened (HighRamUsage, HighCpuUsage, HighDiskUsage, SlowRequest) without a
CWE, and old rows are renamed at startup. `tests/ramHighTracker.test.cjs` and
`tests/resourceStreamNames.test.cjs` cover it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/7459c5bde66ea22966526a7179eede62b5233f0e">The History integrity audit streams each board instead of loading it whole</a>. Thanks to xet7.</summary>
A production server died twice with "JavaScript heap out of memory", 42 and 74
seconds after the hourly History integrity audit started, both times in its
first run after a restart. The audit fetched each board's whole History - every
row with its full previous and new content - into memory. It now streams each
board through a cursor and keeps only hashes and small summaries; the findings
are the same, in the same order. `tests/historyIntegrityStreaming.test.cjs`
compares both on forked, tampered and orphaned chains and fails if a board is
fetched whole.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/f23695cc1bf6447fb38693ea8fe2e1ce4ab51f8f">Scheduled rules act as the board's admin, so a created card has an author</a>. Thanks to xet7.</summary>
Every run of a scheduled rule with a "create card" action failed with "User ID
is required in cards insertAsync". Scheduled rules, auto-archive and attachment
retention acted as `board.createdBy`, but boards have no such field, so they ran
as nobody. They now act as the board's first active admin
(`models/lib/boardActor.js`), and the rule's new card names its author.
`tests/boardActor.test.cjs` scans the tree so nothing reads `board.createdBy`
again.
</details>
**Cards** - exporting a card, and clearing its text.
<details>
<summary><a href="https://github.com/wekan/wekan/commit/997c6d88ad4c67850831aa99de1f874765c90a41">Card Excel export works with only Description or only Labels selected</a>. Thanks to AhmedLukman and xet7.</summary>
The card Excel exporter loads the board, list and swimlane only when the
selected fields need them, and passes `null` for the rest. The shared card
document builder defaulted them with `board = {}`, which applies only to
`undefined`, so it read `.title` of `null` and the download ended in "Export
failed". The titles are optional now (`board?.title || ''`), which also covers
a PDF card export of a card with no swimlane.
`tests/cardExportDocument.test.cjs`
fails on the old code with that TypeError, and
`tests/playwright/specs/card-excel-field-selection.e2e.js` downloads both
workbooks from the real route and checks that each holds only its own field.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/c59c751547aa36fabda088eed4cfd7b8ce6b37e4">REST card update can clear a card title</a>. Thanks to AhmedLukman and xet7.</summary>
`PUT` with `{"title":""}` answered 404 and kept the old title, because the
handler read the title by truthiness. An empty title is a value now, a title
that is not a string is a 400 before anything is written, and
[an update that matches no card](https://github.com/wekan/wekan/commit/79a98822cbe6f1aaa0da0ad2646c7b2cb4fb2726)
is a 404 again. `tests/restCardSort.test.cjs` and
`tests/playwright/specs/rest-card-title.e2e.js` cover it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/aacb2fd4d68c4873bd01685dceee172c24e48379">A cleared card title or description can be undone and redone</a>. Thanks to AhmedLukman and xet7.</summary>
Clearing a value is an edit kept in History, not a deletion, so it is
restorable whatever Admin Panel / Problems / Delete says. Undo already put the
old text back, but redo and Restore of the clearing threw: collection2 removes
`''` from `$set` and then refuses the empty modifier. History, the card details,
the board description and the REST card update now write `''` as it is, and a
REST title of only spaces no longer fails with a 500.
`tests/emptyStringClearWrites.test.cjs` and
`tests/playwright/specs/card-clear-undo-redo.e2e.js` cover it.
</details>
and has the following developer-facing changes:
**Card Excel export** - the browser test for the fix above.
- [A Playwright spec drives the card Excel export with one field selected](https://github.com/wekan/wekan/commit/320a3ca8672b6a70867baa0c3f657d3a5eb53536).
Thanks to AhmedLukman and xet7.
**Node test suites** - a sandbox that resolves its helpers.
- [The attachment cleanup test resolves the Playwright helpers' own requires](https://github.com/wekan/wekan/commit/74dd0b705e21ecb4723dcb8a6055c7edc5aae9aa).
Thanks to xet7.
**WeLite REST API** - the upstream REST specs, run against the native WeLite
target as well.
- [Ownership selection](https://github.com/wekan/wekan/commit/049b628a0310a33026de423a590a6c33489d5b41). Thanks to xet7.
- [Card title edits](https://github.com/wekan/wekan/commit/22dae19a64325695a17dd90ea7f4675ffeecfbed). Thanks to xet7.
- [Board card sorting](https://github.com/wekan/wekan/commit/5f06b28aef680d2682e7fa4e965a0e797b502214). Thanks to xet7.
- [Archive and restore](https://github.com/wekan/wekan/commit/11fc468ff77f9126b97d1eca72de9c2d90314022). Thanks to xet7.
- [Subtasks](https://github.com/wekan/wekan/commit/db3f489ab27f672c9d1ab4db5feaf3a116eba928). Thanks to xet7.
- [Overtime](https://github.com/wekan/wekan/commit/2033c177ce452f59bc6cb9d3d07a6566169ed015). Thanks to xet7.
- [People features](https://github.com/wekan/wekan/commit/72ee1c8b231896586086ac7067ea6dd96135506c). Thanks to xet7.
- [User update](https://github.com/wekan/wekan/commit/e4115e68905f4b9a2d521a749a9fe77dde322aa9). Thanks to xet7.
- [Checklists](https://github.com/wekan/wekan/commit/ede46c7a9873f20864a77eeda7cb5007762824ff). Thanks to xet7.
- [Write-route scope](https://github.com/wekan/wekan/commit/399a8defec10165e1cf7fa18faa5113d5bb7176f). Thanks to xet7.
- [Assignment removal](https://github.com/wekan/wekan/commit/8abb9504bb1f714873419f7b481650d758294ef7). Thanks to xet7.
- [Dropdown item rename](https://github.com/wekan/wekan/commit/b8fd94a7e70bf65e85b8d06b491e4d3d13e3a9ec). Thanks to xet7.
- [Dropdown item deletion](https://github.com/wekan/wekan/commit/f1adc7982eca4aebf8831403f6b4bd219cec51b9). Thanks to xet7.
- [Custom-field lifecycle](https://github.com/wekan/wekan/commit/6bf2d53d756e59f494ea50587f62bc467afb7b77). Thanks to xet7.
- [Webhook settings](https://github.com/wekan/wekan/commit/f34fee658206ab4d90583f58746067793f10d12a). Thanks to xet7.
- [Native Playwright credentials are seeded before an API token is used](https://github.com/wekan/wekan/commit/a9059b7b155aaea4bf9ccb1647a492bab251bb10).
Thanks to xet7.
**WeLite attachments** - the attachment workflows in the native browser.
- [The upstream card attachment cascade spec](https://github.com/wekan/wekan/commit/26e27f62c4b6b9e2bcd1e10623de7dd3e0b31b5e). Thanks to xet7.
- [Attachment rename, and a missing form token is refused](https://github.com/wekan/wekan/commit/7c3b798a1d0ff6e26b6afa8f49c3359a73ba526a). Thanks to xet7.
- [Direct attachment removal in Chromium](https://github.com/wekan/wekan/commit/c060c6d2db51b2fc22fab72dadecd90ab173bd8f). Thanks to xet7.
- [The Version Control Attachments workflow](https://github.com/wekan/wekan/commit/b6bc2b200ce7545ca43b2f6b3a3ac39874227812). Thanks to xet7.
- [The Finnish attachment preview](https://github.com/wekan/wekan/commit/c5344761d856cf5234e5a12ccc61f336c6a9a0e8). Thanks to xet7.
- [The cascade spec reuses its browser session](https://github.com/wekan/wekan/commit/bd6b00c5f437237a3cab8bf7d51172d948e45462). Thanks to xet7.
- [The attachment browser workflow gets the time it needs](https://github.com/wekan/wekan/commit/333928f123f9dd061042c8b18b0e44663dc76d04). Thanks to xet7.
**WeLite boards and sessions** - export links and session revocation.
- [Both export links on the board](https://github.com/wekan/wekan/commit/075e6dbe730291543c8a384ce58429167976741c). Thanks to xet7.
- [Revoking one browser session](https://github.com/wekan/wekan/commit/e30c439fa7f4e82bb2f4f949513aa1fcc4287953). Thanks to xet7.
**WeLite right-to-left captions** - Arabic table captions read in their own
direction.
- [People table captions](https://github.com/wekan/wekan/commit/f1fe22ac16254fa3d7f14df6c09dd3f250c7d61a). Thanks to xet7.
- [Regional Arabic People table captions](https://github.com/wekan/wekan/commit/8c1152f23468e76d07c964b5f1358900372c8248). Thanks to xet7.
- [Arabic webhook field captions](https://github.com/wekan/wekan/commit/6f7292cffdfb42a7accf4955735bbd8a43d4472a). Thanks to xet7.
- [Regional Arabic attachment captions](https://github.com/wekan/wekan/commit/ba9504d6db8dbd2adf8e72b98cb10c991a379cda). Thanks to xet7.
Thanks to above GitHub users for their contributions and translators for their translations.
# v13.15 2026-11-18 WeKan ® release
**In short:** **RaceBleed** is fixed: deleting a card while somebody moves it
to another board no longer destroys its checklists, comments and attachments
while the card itself survives there, and a member deleting a card that was
just moved keeps their account. REST handlers now answer **404, not 500**, for
a swimlane, user or board that is not there.
This release fixes the following CRITICAL SECURITY ISSUE of [RaceBleed](https://wekan.fi/hall-of-fame/racebleed/):
<details>
<summary><a href="https://github.com/wekan/wekan/commit/c7a496c9cfd8f30e5bda16515eedeaa2ec80dc65">A card's children are destroyed only for a card whose own removal happened</a>. Thanks to xingmuse and xet7.</summary>
[GHSA-3vjg-3p4q-8fwh](https://github.com/wekan/wekan/security/advisories/GHSA-3vjg-3p4q-8fwh),
CWE-367. The REST card delete looked the card up on the board the caller was
authorised for, destroyed its checklists, checklist items, comments,
attachments and subcards by card id, and removed the card itself last, keyed
on that board and list. A move to another board landing in between left the
card alive on a board the deleter cannot read, stripped of every child, with
both requests answering 200. Every hooked removal had the same shape:
collection-hooks runs `Cards.before.remove`, where the cascade was, and then
removes by the caller's original selector - a swimlane, a delete batch, a
parent - which a moved card no longer matches. The custom-field link clean-up
did the same to the cards linked to it.
The card document is now the claim (`models/lib/claimedCardRemoval.js`): the
single and bulk REST deletes remove the card first and destroy its children
only when that removal matched, and the hooked removals cascade from
`Cards.after.remove`, only for a card that is really gone. A list deletion
removes a card only while it is still in that list, and the REST board move
that loses to a delete is a 404 instead of a 500.
A delete that lost the race, or arrived after the card was moved away from
the named board, is refused and shows in Admin Panel / Problems as RaceBleed
(`authz.card-delete-race`, medium). It never disables the account: a stale
view is not an attack, and PurgeBleed's critical record used to disable a
member who deleted a card somebody had just moved.
`tests/claimedCardRemoval.test.cjs` replays the reported race and scans
`server/` for any cascade before or without the card's removal;
`tests/playwright/specs/race-bleed.e2e.js` races twelve moves against
deletes and checks that a surviving card always keeps its checklist.
</details>
and fixes the following bug:
<details>
<summary><a href="https://github.com/wekan/wekan/commit/baaeea27e3dc6083b5d6a39d5b44a4e6d26ca088">REST API: a handler's not-found error is a 404, not a 500</a>. Thanks to xet7.</summary>
`httpStatusForError` knew only `NotFound`, while about two hundred throw sites
spell it Meteor's way - `not-found`, `board-not-found`, `user-not-found` and
the rest. So deleting a missing swimlane, or adding a board member nobody is
called, answered 500 "Internal server error" on a real server, though the
unit test, which stubs the helper, saw the 404. Any name that is or ends in
`not-found` is now a 404 with its message; anything unknown is still a 500
carrying no detail. `tests/restNotFoundStatus.test.cjs` runs the real helper
and fails on a spelling it would not map.
</details>
Thanks to above GitHub users for their contributions and translators for their translations.
+13 -8
View File
@@ -5,6 +5,19 @@ each one changed and the project status are in
Written by `node releases/changelog-short.mjs` from CHANGELOG-big.md:
make changes there.
# v13.40 2026-12-02 WeKan ® release
Native **WeKan board imports** preserve required list fields
and handle **Notion** and **Planka** synchronization metadata. Multiline
board labels save correctly. **OpenProject** transfers preserve assignees and
milestone dates and budgets. List Sync can write back compatible type
changes and budget choices.
**Jira** transfers retain description panels and API exports preserve inline
formatting. List Sync can also read and update Jira start dates. The
**Univention App Center** package starts with the shell-free WeKan image.
[All changes in v13.40](CHANGELOG-big.md#v1340-2026-12-02-wekan--release)
# v13.39 2026-12-02 WeKan ® release
The export menu sends selected WeKan cards to a chosen **Jira**
@@ -50,11 +63,3 @@ Filtering a board by **yourself as assignee** now survives a page
refresh, as filtering by anybody else already did.
[All changes in v13.36](CHANGELOG-big.md#v1336-2026-11-27-wekan--release)
# v13.35 2026-11-27 WeKan ® release
A **due date that is not due soon is grey** again, on the card
and the minicard, instead of a yellow that looked almost like the amber of
"due soon".
[All changes in v13.35](CHANGELOG-big.md#v1335-2026-11-27-wekan--release)
+1 -1
View File
@@ -62,7 +62,7 @@ FROM --platform=$BUILDPLATFORM debian:trixie AS bundle
ARG TARGETARCH
ARG TARGETVARIANT
ARG VERSION=13.39
ARG VERSION=13.40
ARG DEBIAN_FRONTEND=noninteractive
COPY --chmod=755 releases/check-telemetry.py /tmp/check-telemetry.py
+1 -1
View File
@@ -1,5 +1,5 @@
appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928
appVersion: "v13.39.0"
appVersion: "v13.40.0"
files:
userUploads:
- README.md
+16 -13
View File
@@ -86,9 +86,11 @@ details; WeKan's are below.
WeKan's Card Settings specs toggle them in desktop Chromium and pass; it
needs the reporter's details to reproduce - which popup, whether as a board
admin, and the browser console's error. The comment's spacing is fixed.)
- Run the full Firefox and WebKit Playwright stages with the Docker backend
on the host. Native Firefox and WebKit need their own browser sandboxes,
which cannot start inside Flatpak.
- Finish the full Firefox and WebKit Playwright verification with the Docker
backend on the host. The Firefox run on 2026-12-02 reported 4,000 passed,
15 failed and 224 skipped. The 15 failures passed targeted reruns after
the relevant fixes. A full Firefox run on the updated checkout and the
full WebKit results are still pending.
## Feature requests: Import, Export and Sync with other programs
@@ -110,28 +112,29 @@ Completed import, export and sync changes are recorded in the
- **Other file-only providers** still need API import and Sync using
stable external task IDs. See
[the API package review](docs/Features/Board-Sidebar/Board-Settings/Import-Export/Sync.md#api-packages-on-npm-checked-2026-11-28).
- **Notion** still needs durable resumption for bulk imports above the 64 MiB server
checkpoint budget, and support for assembled Markdown above the
5 MiB single-page limit, and verification of relation rollups beyond
the 25 external page lookups available in one List Sync run when
the targets have no verified direct relations anywhere in the source.
- **Notion** still needs durable resumption for bulk imports above the 256 MiB decoded
or 64 MiB encoded server checkpoint budget, support for List Sync Markdown
above 6 MiB per page and one-time imports above 7 MiB.
- **Jira Cloud and Data Center** still need additional rich formatting
in write-back, including Jira Cloud media inside expandable sections,
additional marks, and Data Center macro combinations. More writable
in write-back, including other Jira Cloud document structures and Data Center
macro combinations. More writable
fields in List Sync also remain open.
- **More Jira project records**: recover historical commitments that cannot be reconstructed from imported issues,
and preserve other project-wide records.
- **Export to the service**: the OpenProject export menu creates work
packages with their title, optional description, start and due dates,
writable work estimates and progress, parent relationships, and supported
dependencies between selected cards.
dependencies between selected cards. The export can also match one card
assignee to an eligible destination user. Responsible and other person
fields remain open.
The Jira export menu creates issues with a title, optional description,
due dates, supported start dates, labels, matching priorities and versions, Jira component assignments,
and mapped time estimates in the
selected project and issue type.
It creates supported dependency links and exports first-level children
using the selected Jira subtask type. Support more fields in both services
and deeper Jira hierarchies where the target project supports them.
using the selected Jira subtask type. Support more fields in both services.
Verify the Jira Cloud hierarchy export against a live project with levels
above Epic.
- **Sync more than a list**: add swimlane and single-card Sync targets,
each with Sync Settings and History in its own menu. Support additional
custom fields and people mappings.
+6 -2
View File
@@ -1201,9 +1201,12 @@ function start_spec_test_server(){
local writable="$WEKAN_DIR/.tools/test-writable"
mkdir -p "$writable/files"
export WEKAN_FILES_PATH="$writable/files" WEKAN_FILES_PATH_HOST="$writable/files"
# The email specs own a local SMTP listener on this port.
export WEKAN_TEST_SMTP_PORT="${WEKAN_TEST_SMTP_PORT:-2525}"
echo "==> Starting the WeKan test server on http://localhost:3000 (log: $logdir/wekan-test-server.log)."
MONGO_URL="$WEKAN_MONGO_URL" ROOT_URL="http://localhost:3000" PORT=3000 \
WRITABLE_PATH="$writable" WITH_API=true \
WRITABLE_PATH="$writable" WITH_API=true BROWSER_POLICY_ENABLED=true \
MAIL_URL="smtp://127.0.0.1:$WEKAN_TEST_SMTP_PORT" EMAIL_NOTIFICATION_TIMEOUT=100 \
LIST_SYNC_ALLOWED_PRIVATE_HOSTS="${LIST_SYNC_ALLOWED_PRIVATE_HOSTS:-127.0.0.1}" \
API_IMPORT_ALLOWED_PRIVATE_HOSTS="${API_IMPORT_ALLOWED_PRIVATE_HOSTS:-127.0.0.1}" \
DEFAULT_METEOR_REACTIVITY_ORDER="changeStreams,oplog,polling" \
@@ -1262,6 +1265,7 @@ function run_playwright_spec(){
fi
local args=("$spec")
[ -n "$grep" ] && args+=(--grep "$grep")
local WEKAN_TEST_SMTP_PORT="${WEKAN_TEST_SMTP_PORT:-}"
local logdir
logdir="$(log_directory test-playwright-spec)" || return $?
mkdir -p "$logdir"; logdir="$(cd "$logdir" && pwd)"
@@ -3408,7 +3412,7 @@ for _once in 1; do
#---------------------------------------------------------------------
# Logging of terminal output to console and to .tools/log/wekan-log.log at end of this line: 2>&1 | tee "$(one_log dev-server)"
#WARN_WHEN_USING_OLD_API=true NODE_OPTIONS="--trace-warnings"
DEFAULT_METEOR_REACTIVITY_ORDER="changeStreams,oplog,polling" DDP_TRANSPORT=sockjs DEBUG="${DEBUG:-false}" WRITABLE_PATH=.. WITH_API=true ROOT_URL=http://localhost:3000 "${DEV_COMMAND[@]}" --port 3000 2>&1 | tee "$(one_log dev-server)"
DEFAULT_METEOR_REACTIVITY_ORDER="changeStreams,oplog,polling" DDP_TRANSPORT=sockjs DEBUG="${DEBUG:-false}" WRITABLE_PATH=.. WITH_API=true BROWSER_POLICY_ENABLED="${BROWSER_POLICY_ENABLED:-true}" ROOT_URL=http://localhost:3000 "${DEV_COMMAND[@]}" --port 3000 2>&1 | tee "$(one_log dev-server)"
#---------------------------------------------------------------------
break
;;
+14 -4
View File
@@ -1424,10 +1424,10 @@ THEME - Apple Glass Pastel
.board-color-appleglasspastel input.primary,
.board-color-appleglasspastel .sidebar .sidebar-content .sidebar-btn,
.board-color-appleglasspastel .selected-calendar-picker button.primary {
/* Tinted glass: the blue with a highlight across its upper half. */
/* Keep white text readable across the glass highlight. */
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 55%),
#2563eb;
linear-gradient(180deg, rgba(255, 255, 255, 0.20) 0%, rgba(255, 255, 255, 0) 55%),
#1e40af;
border: 0;
border-radius: 999px;
box-shadow:
@@ -1442,10 +1442,20 @@ THEME - Apple Glass Pastel
.board-color-appleglasspastel button.primary:hover,
.board-color-appleglasspastel input.primary:hover,
.board-color-appleglasspastel .selected-calendar-picker button.primary:hover {
background: #1d4ed8;
background: #1e3a8a;
color: #fff;
}
.board-color-appleglasspastel .card-details button.js-reminder-date.add-label {
background: #dbeafe;
}
.board-color-appleglasspastel .card-details button.js-reminder-date.add-label:hover {
background: #bfdbfe;
}
.board-color-appleglasspastel .card-details button.js-reminder-date.add-label .fa {
color: #1e3a8a;
}
.board-color-appleglasspastel input[type="email"],
.board-color-appleglasspastel input[type="password"],
.board-color-appleglasspastel input[type="text"],
+20 -19
View File
@@ -347,22 +347,23 @@ template(name="boardViewMenu")
cannot be read without hovering - so the button says which view is on.
The bar wraps to a second row when it runs out of width, which is what
makes a word beside the icon affordable. docs/Features/Header-Bar/Header.md
a.board-header-btn.js-toggle-board-view(title="{{boardViewName}}")
i.fa.fa-caret-down
if $eq boardView 'board-view-swimlanes'
i.fa.fa-th-large
if $eq boardView 'board-view-lists'
i.fa.fa-trello
if $eq boardView 'board-view-cal'
i.fa.fa-calendar
if $eq boardView 'board-view-calendar-mode'
i.fa.fa-calendar-check-o
if $eq boardView 'board-view-gantt'
i.fa.fa-bar-chart
if $eq boardView 'board-view-table'
i.fa.fa-table
if $eq boardView 'board-view-stats'
i.fa.fa-pie-chart
span.board-header-btn-label= boardViewName
//- The open view's ? (featureHelp.jade), after the menu that names it.
+featureHelp(id=boardViewHelp)
.board-view-controls
a.board-header-btn.js-toggle-board-view(title="{{boardViewName}}")
i.fa.fa-caret-down
if $eq boardView 'board-view-swimlanes'
i.fa.fa-th-large
if $eq boardView 'board-view-lists'
i.fa.fa-trello
if $eq boardView 'board-view-cal'
i.fa.fa-calendar
if $eq boardView 'board-view-calendar-mode'
i.fa.fa-calendar-check-o
if $eq boardView 'board-view-gantt'
i.fa.fa-bar-chart
if $eq boardView 'board-view-table'
i.fa.fa-table
if $eq boardView 'board-view-stats'
i.fa.fa-pie-chart
span.board-header-btn-label= boardViewName
//- The open view's ? (featureHelp.jade), after the menu that names it.
+featureHelp(id=boardViewHelp)
+6
View File
@@ -1532,6 +1532,12 @@ body.desktop-mode .card-details.card-details-position-pending:not(.card-details-
}
/* Jira Cloud status labels show their text even without a color match. */
.card-details div[data-jira-panel] {
border-inline-start: 3px solid currentColor;
margin-block: 0.75em;
padding-inline-start: 0.75em;
}
.card-details span[data-jira-status] {
border: 1px solid var(--jira-status-color, currentColor);
background-color: color-mix(in srgb, var(--jira-status-color, currentColor) 12%, transparent);
+2 -2
View File
@@ -219,7 +219,7 @@ Template.cardLabelsPopup.events({
Template.createLabelPopup.events({
// Create the new label
'submit .create-label'(event, templateInstance) {
async 'submit .create-label'(event, templateInstance) {
event.preventDefault();
const board = getCardLabelBoard(templateInstance.data);
if (!board) {
@@ -245,7 +245,7 @@ Template.createLabelPopup.events({
}
color = color || getFallbackLabelColor();
const dueAt = readLabelDueAt(templateInstance);
board.addLabel(name, color, dueAt);
await board.addLabel(name, color, dueAt);
Popup.back();
},
});
+6 -3
View File
@@ -65,9 +65,12 @@
margin-inline-start: 0;
}
/* The Board View menu in the header bar: beside the view's button. */
.board-header-btn + .feature-help-btn {
margin-inline-start: 2px;
/* Keep the help button with its menu when the header wraps. */
.board-view-controls {
display: inline-flex;
align-items: center;
flex: 0 0 auto;
gap: 2px;
}
/* A popup's title bar places its maximize and close buttons absolutely at its
@@ -38,7 +38,8 @@ mapping when **Labels** is selected.
The full-board import page fetches page contents in batches. If the fetch
leaves page contents pending, click **Fetch** again on the same page to
continue before importing the board. The first page in a batch can supply
up to 5 MiB of Markdown across its responses.
up to 7 MiB of Markdown across its responses. List Sync uses a 6 MiB
limit because it also keeps the source value for conflict detection.
After reloading the same tab, enter the same Notion token and select the
same source and fields to continue. WeKan compresses the checkpoint when
@@ -54,8 +55,10 @@ To create several boards at once, select multiple data sources and click
contents and reports any missing content through its import report. If a
fetch pauses, that source stays available to retry. Repeat the import with the
same source, token, and selected fields within one hour to continue from its
server checkpoint. Each source checkpoint can hold up to 64 MiB before
compression.
server checkpoint. Each source checkpoint can hold up to 256 MiB of decoded
data and 64 MiB after compression and storage encoding. If an incomplete
source exceeds either limit, WeKan reports that it is too large to import
and leaves it available for a smaller import.
When importing into an existing board, choose **Notion (API)** in the
destination's import menu. WeKan fetches up to eight batches at a time.
@@ -103,8 +106,9 @@ Incomplete rollups preserve existing assignments.
With **Dependencies** selected, a rollup named **Dependencies** or
**Related pages** can supply links to pages in the same or another data
source. WeKan verifies up to 25 distinct external target pages per run.
Targets already verified through a direct relation use no page lookups,
source. WeKan verifies up to 25 new external targets per run. A later run
can resume the same verification within one hour using the same list and
credentials. Targets already verified through a direct relation use no page lookups,
even when that relation appears on another page of the source.
An empty or incomplete rollup, or a target that cannot be verified,
keeps existing links intact.
@@ -10,7 +10,7 @@ This is without container (without Docker or Snap).
Right click and download files 1-4:
1. [wekan-13.39-win64.zip](https://github.com/wekan/wekan/releases/download/v13.39/wekan-13.39-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
1. [wekan-13.40-win64.zip](https://github.com/wekan/wekan/releases/download/v13.40/wekan-13.40-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
2. [node.exe](https://nodejs.org/dist/latest-v26.x/win-x64/node.exe)
@@ -22,7 +22,7 @@ Right click and download files 1-4:
6. Double click `mongodb-windows-x86_64-7.0.34-signed.msi` . In installer, uncheck downloading MongoDB compass.
7. Unzip `wekan-13.39-win64.zip` , inside it is directory `bundle`, to it copy other files:
7. Unzip `wekan-13.40-win64.zip` , inside it is directory `bundle`, to it copy other files:
```
bundle (directory)
+1 -1
View File
@@ -12,7 +12,7 @@ export function getSecureDOMPurifyConfig(options = {}) {
// Allow common markdown elements including anchor tags
ALLOWED_TAGS: ['a', 'p', 'br', 'strong', 'em', 'u', 'cite', 's', 'del', 'strike', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'img', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'hr', 'div', 'span', 'time', 'details', 'summary'],
// Allow safe attributes including href for anchor tags
ALLOWED_ATTR: ['href', 'title', 'alt', 'src', 'width', 'height', 'target', 'rel', 'datetime', 'data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block'],
ALLOWED_ATTR: ['href', 'title', 'alt', 'src', 'width', 'height', 'target', 'rel', 'datetime', 'data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block', 'data-jira-panel'],
// Allow safe protocols for links
// Plus the custom schemes an administrator listed (#3218, options.urlSchemes
// from models/lib/urlSchemeAllowlist.js, which never includes javascript:
+1
View File
@@ -3022,6 +3022,7 @@ Boards.helpers({
},
async addLabel(name, color, dueAt, { jiraComponent, jiraComponentUserIds } = {}) {
if (Meteor.isClient) return Meteor.callAsync('boards.addLabel', this._id, name, color, dueAt);
const trimmedName = typeof name === 'string' ? name.trim() : name;
if (!this.getLabel(trimmedName, color)) {
const _id = Random.id(6);
+1
View File
@@ -476,6 +476,7 @@ Cards.attachSchema(
'syncTodoistOccurrence.date': { type: String },
'syncLastSource.reminderDate': { type: String, optional: true },
'syncLastSource.startDate': { type: String, optional: true },
'syncLastSource.startDateMapping': { type: String, optional: true, max: 28 },
'syncLastSource.dueDate': { type: String, optional: true },
'syncLastSource.dueComplete': { type: Boolean, optional: true },
'syncLastSource.title': { type: String, optional: true },
+1 -1
View File
@@ -239,7 +239,7 @@ export class KanboardCreator {
const sourceListId = this.source === 'deck' && Number.isSafeInteger(task.column_index)
? this.listIdsByColumn[task.column_index] : undefined;
const swimlaneName = task.swimlane_name || task.swimlane || 'Default';
const plan = planImportedTask(task, { members: this.members, allowedColors: CARD_COLORS,
const plan = planImportedTask(task, { members: this.members, allowedColors: CARD_COLORS, source: this.source,
boardMemberIds: (board.members || []).filter(m => m.isActive !== false).map(m => m.userId) });
const cardToCreate = {
...plan.card,
+22
View File
@@ -75,6 +75,28 @@ export async function listCreateIssueTypes(credentials, projectKey, request, inc
throw new Error('Jira issue type pagination did not finish');
}
// Create metadata lists the available types, but project metadata supplies
// their levels. Intersect the two so an unavailable type cannot be selected.
export async function listJiraCloudCreateHierarchy(client, projectKey, createTypes) {
if (!client.cloud || !/^[A-Z][A-Z0-9_]{0,99}$/i.test(projectKey)) return [];
let project;
try {
project = await client.get(`/rest/api/3/project/${projectKey}`);
} catch (error) {
if ([400, 403, 404].includes(error.status)) return [];
throw error;
}
if (typeof project?.key !== 'string' || project.key.toUpperCase() !== projectKey.toUpperCase() || !Array.isArray(project.issueTypes)) return [];
const levels = new Map();
for (const type of project.issueTypes) {
if (typeof type?.id !== 'string' || levels.has(type.id) ||
!Number.isSafeInteger(type.hierarchyLevel) || type.hierarchyLevel < -1) return [];
levels.set(type.id, type.hierarchyLevel);
}
return createTypes.filter(type => levels.has(type.id) && Boolean(type.subtask) === (levels.get(type.id) === -1))
.map(type => ({ ...type, hierarchyLevel: levels.get(type.id) }));
}
async function issueRecords(get, path, key, options = '') {
const rows = [];
const seen = new Set();
+30 -15
View File
@@ -1,4 +1,4 @@
import { isNotionId } from '../notionApiFormat.js';
import { isNotionId, MAX_NOTION_IMPORT_MARKDOWN_BYTES } from '../notionApiFormat.js';
const API = 'https://api.notion.com/v1';
const MAX_RESULTS = 10000;
@@ -104,7 +104,7 @@ const MAX_BODY_PAGES = 100;
const MAX_BODY_BYTES = 4 * 1024 * 1024;
// A synced card also stores a source baseline. Keep the assembled value well
// below half of MongoDB's document limit even when the baseline repeats it.
const MAX_PAGE_BYTES = 5 * 1024 * 1024;
const MAX_SYNC_PAGE_BYTES = 6 * 1024 * 1024;
function unknownBlockReference(url, ids) {
// Notion uses hyphenated UUIDs and compact UUIDs in links. Match the
@@ -163,7 +163,7 @@ async function recoverPageMarkdown(getMarkdown, id, maxPageBytes, ancestors = []
}
async function readPageBodies(get, pages, after, resume, forSync) {
const maxPageBytes = MAX_PAGE_BYTES;
const maxPageBytes = forSync ? MAX_SYNC_PAGE_BYTES : MAX_NOTION_IMPORT_MARKDOWN_BYTES;
let total = 0;
let received = 0;
let downloadBudget = MAX_BODY_BYTES;
@@ -374,11 +374,11 @@ async function pagePeople(get, page, name, state, isRollup) {
return { emails: [...emails], complete };
}
export function fetchForSync(credentials, id, request, fields = ['title', 'description'], after = '', resume) {
return fetch(credentials, id, request, fields, { forSync: true, after, resume });
export function fetchForSync(credentials, id, request, fields = ['title', 'description'], after = '', resume, rollupResume) {
return fetch(credentials, id, request, fields, { forSync: true, after, resume, rollupResume });
}
export async function fetch(credentials, id, request, fields, { forSync = false, after, resume, importBodyAfter } = {}) {
export async function fetch(credentials, id, request, fields, { forSync = false, after, resume, rollupResume, importBodyAfter } = {}) {
if (!isNotionId(id)) throw new Error('Choose a Notion data source');
const get = notionRequest(credentials, request);
const source = await get(`data_sources/${id}`);
@@ -467,7 +467,10 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
}
}
}
const rollupTargets = new Map();
const previousRollupTargets = rollupResume?.sourceId === id ? rollupResume.targets : [];
const rollupTargets = new Map(previousRollupTargets);
let rollupLookups = 0;
let rollupDeferred = false;
const rollupReads = { rateLimited: false, nextRequestAt: 0 };
const statusType = source.properties[status]?.type;
const seen = new Set();
@@ -492,6 +495,7 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
let links = includeRelations && relationsComplete ? await pageRelations(get, row, relations, forSync) : undefined;
const checkedRollupSources = new Set();
if (links && relationRollups.length) {
let complete = true;
const ids = new Set(links.relations);
const directTargets = new Set(links.crossRelations.map(target => target.pageId));
for (const name of relationRollups) {
@@ -510,16 +514,22 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
continue;
}
const knownParent = directRollupParents.get(link.id);
if (!knownParent && !rollupTargets.has(link.id) && rollupTargets.size < 25) {
const target = await getNotionDetail(get, `pages/${link.id}`, rollupReads);
const parent = target?.parent?.data_source_id;
rollupTargets.set(link.id, target?.object === 'page' && target.id === link.id &&
!target.in_trash && !target.archived && isNotionId(parent) ? parent : null);
if (!knownParent && !rollupTargets.has(link.id)) {
if (rollupLookups < 25 && rollupTargets.size < MAX_RESULTS && !rollupReads.rateLimited) {
rollupLookups += 1;
const target = await getNotionDetail(get, `pages/${link.id}`, rollupReads);
const parent = target?.parent?.data_source_id;
if (!rollupReads.rateLimited) {
rollupTargets.set(link.id, target?.object === 'page' && target.id === link.id &&
!target.in_trash && !target.archived && isNotionId(parent) ? parent : null);
}
}
if (!rollupTargets.has(link.id)) rollupDeferred = true;
}
const parent = knownParent || rollupTargets.get(link.id);
if (!parent || parent === id) {
links = undefined;
break;
complete = false;
continue;
}
checkedRollupSources.add(parent);
if (!links.crossRelations.some(target => target.sourceId === parent && target.pageId === link.id)) {
@@ -530,7 +540,8 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
}
if (!links) break;
}
if (links) links.relations = [...ids];
if (links && complete) links.relations = [...ids];
else links = undefined;
}
const formula = props[description]?.formula;
const descriptionText = formulaDescription
@@ -573,6 +584,10 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
const bodyState = fields?.includes('description') || (!forSync && !fields?.length)
? await readPageBodies(get, normalized, forSync ? after : importBodyAfter, resume, forSync) : undefined;
return {
...(rollupDeferred && rollupTargets.size ? { rollupCheckpoint: {
sourceId: id, startedAt: rollupResume?.sourceId === id ? rollupResume.startedAt : Date.now(),
targets: [...rollupTargets],
} } : {}),
...(forSync && bodyState ? { nextBodyAfter: bodyState.nextBodyAfter, bodyCheckpoint: bodyState.checkpoint } : {}),
...(importBodyAfter !== undefined ? { nextImportBodyAfter: bodyState?.limited ? bodyState.nextBodyAfter : null } : {}),
source: {
+15
View File
@@ -1,8 +1,23 @@
import openProjectDurations from '../openProjectDurations.js';
import { openProjectVersionLinks, openProjectEmbeddedVersions, openProjectPlanningLinkId, openProjectChoicePath, openProjectChoiceWeight, openProjectChoiceParent, openProjectChoiceText } from '../openProjectVersions.js';
const PAGE_SIZE = 100;
const MAX_PAGES = 200;
export function openProjectBudgetLinks(page) {
const rows = page?._embedded?.elements;
if (page?._type !== 'Collection' || !Array.isArray(rows) || rows.length !== page.total ||
rows.length !== page.count || rows.length > 10000) return undefined;
const ids = new Set();
for (const row of rows) {
if (row?._type !== 'Budget' || !Number.isSafeInteger(row.id) || row.id < 1 || ids.has(row.id) ||
row._links?.self?.href !== `/api/v3/budgets/${row.id}` ||
!openProjectDurations.OPENPROJECT_TEXT_FIELDS.budget.valid(row.subject)) return undefined;
ids.add(row.id);
}
return rows.map(row => ({ title: row.subject, href: row._links.self.href }));
}
export function openProjectApiHeaders(token) {
return {
Authorization: `Basic ${Buffer.from(`apikey:${token}`).toString('base64')}`,
+1 -1
View File
@@ -56,7 +56,7 @@ const API_IMPORT_SERVICES = [
directExport: {
listMethod: 'apiExportListOpenProject',
writeMethod: 'apiExportOpenProject',
fields: ['description', 'dates', 'custom-fields', 'subtasks', 'dependencies'],
fields: ['description', 'dates', 'labels', 'people', 'custom-fields', 'subtasks', 'dependencies'],
},
fields: [
{ name: 'url', label: 'api-import-url', required: true },
+4 -4
View File
@@ -15,13 +15,13 @@
const { apiImportService } = require('./apiImportServices');
const SYNC_PROVIDERS = {
jira: { writeBack: ['title', 'description', 'due-date', 'scrum-estimate'] },
jira: { writeBack: ['title', 'description', 'card-start', 'due-date', 'scrum-estimate'] },
github: { name: 'GitHub' },
gitlab: { name: 'GitLab', writeBack: [] },
gitea: { name: 'Gitea' },
forgejo: { name: 'Forgejo' },
openproject: { writeBack: ['title', 'description', 'card-start', 'due-date',
'sync-original-time', 'sync-remaining-time', 'scrum-estimate'] },
'sync-original-time', 'sync-remaining-time', 'scrum-estimate', 'type', 'billing-budget'] },
mstodo: { url: 'https://graph.microsoft.com', sign: 'token', writeBack: ['title', 'description', 'due-date', 'card-start'] },
googletasks: { url: 'https://tasks.googleapis.com', sign: 'token', writeBack: ['title', 'description', 'due-date'] },
todoistapi: { url: 'https://api.todoist.com', sign: 'token', writeBack: ['title', 'description', 'comments'] },
@@ -55,7 +55,7 @@ const API_SYNC_SOURCES = Object.fromEntries(SYNC_CAPABLE_SOURCES.filter(type =>
const ISSUE_CALENDAR_DATE_SOURCES = ['jira', 'openproject', 'redmineapi', 'linearapi'];
const CALENDAR_DUE_DATE_SOURCES = [...ISSUE_CALENDAR_DATE_SOURCES, 'googletasks', 'wrikeapi', 'mondayapi'];
const CALENDAR_START_DATE_SOURCES = ['openproject', 'redmineapi', 'wrikeapi', 'mondayapi'];
const CALENDAR_START_DATE_SOURCES = ['jira', 'openproject', 'redmineapi', 'wrikeapi', 'mondayapi'];
const START_DATE_SYNC_SOURCES = [...CALENDAR_START_DATE_SOURCES, 'trellolist', 'clickupapi', 'asana', 'todoistapi', 'mstodo', 'notionapi'];
const DUE_DATE_SYNC_SOURCES = [...CALENDAR_DUE_DATE_SOURCES, 'mstodo', 'trellolist', 'planka', 'clickupapi', 'asana', 'todoistapi', 'notionapi'];
@@ -134,7 +134,7 @@ const { OPENPROJECT_ROLLUP_NAMES, OPENPROJECT_DERIVED_DATES, OPENPROJECT_BOOLEAN
function listSyncFields(type) {
if (!SYNC_CAPABLE_SOURCES.includes(type)) return [];
const planning = SOURCE_PLANNING[type] || [];
if (type === 'jira') return ['title', 'description', 'dueDate', 'spentTime', 'estimate',
if (type === 'jira') return ['title', 'description', 'dueDate', 'startDate', 'spentTime', 'estimate',
'originalEstimate', 'remainingEstimate', 'jiraVotes', 'jiraVoterIdentities', 'jiraHistory', ...planning, 'dependencies', 'subtasks', 'comments', 'labels'];
if (type === 'openproject') return ['title', 'description', 'dueDate', 'startDate', 'spentTime', ...planning,
'dependencies', 'subtasks', 'comments', 'labels', 'timeEntries', 'openProjectHierarchy', 'originalEstimate', 'remainingEstimate', 'progress',
+8 -3
View File
@@ -53,11 +53,16 @@ function sanitizeTransferValue(input, options = {}) {
// Canonical JSON and the Excel transport legitimately carry base64.
// Give syntactically-valid base64 a separate cap while retaining a much
// smaller limit for attacker-controlled prose/markup.
const binaryLimit = value.length > limits.maxString
const pathLimit = options.maxStringForPath?.(path);
const stringLimit = pathLimit ?? limits.maxString;
const binaryLimit = value.length > stringLimit
&& /\/(?:file|avatarFile|excelBase64)$/.test(path)
&& value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value)
? limits.maxBinaryString : limits.maxString;
if (value.length > binaryLimit) throw boundaryError(`Import/export string limit exceeded at ${path}`, 'limit');
? limits.maxBinaryString : stringLimit;
if (value.length > binaryLimit ||
(pathLimit !== undefined && new TextEncoder().encode(value).byteLength > pathLimit)) {
throw boundaryError(`Import/export string limit exceeded at ${path}`, 'limit');
}
// Avoid running multi-megabyte base64 attachment bodies through DOMPurify,
// but do pass every string that can carry active markup, a script URL or
// CSS payload through WeKan's established server sanitizer.
+6 -1
View File
@@ -54,7 +54,12 @@ function pruneOpenProject(doc, wanted) {
if (!wanted.has('comments') && details) delete details.activities;
if (!wanted.has('attachments') && details) delete details.attachments;
if (!wanted.has('dependencies') && details) delete details.relations;
if (!wanted.has('people') && details) delete details.watchers;
if (!wanted.has('people')) {
if (details) delete details.watchers;
if (row._links && typeof row._links === 'object') {
for (const role of ['assignee', 'responsible', 'author', 'watchers']) delete row._links[role];
}
}
if (!wanted.has('dates')) {
for (const key of ['startDate', 'dueDate', 'due_date', 'date', 'createdAt', 'updatedAt', 'spentTime']) delete row[key];
if (details) delete details.timeEntries;
+5 -1
View File
@@ -188,7 +188,7 @@ export function importedChecklists(checklists, members = {}) {
// `boardMemberIds` are the new board's members. A source watcher becomes a
// card watcher only when mapped to one of them: watching grants no access,
// but a watcher outside a private board must not receive its notifications.
export function planImportedTask(task, { members = {}, allowedColors = [], boardMemberIds = [], now } = {}) {
export function planImportedTask(task, { members = {}, allowedColors = [], boardMemberIds = [], source, now } = {}) {
const card = {
title: text(task.title) || 'Imported task',
description: text(task.description),
@@ -236,6 +236,10 @@ export function planImportedTask(task, { members = {}, allowedColors = [], board
.filter(key => (typeof key === 'string' && key) || (typeof key === 'number' && Number.isFinite(key)))
.map(key => members[key])
.filter(Boolean))];
if (source === 'openproject' && task.owner_username) {
const assigneeId = members[task.owner_username];
if (boardMemberIds.includes(assigneeId)) card.assignees = [assigneeId];
}
const watcherKeys = (Array.isArray(task.watchers) ? task.watchers : [])
.filter(key => (typeof key === 'string' && key) || (typeof key === 'number' && Number.isFinite(key)));
const watcherIds = [...new Set(watcherKeys.map(key => members[key]).filter(id => id && boardMemberIds.includes(id)))];
+74 -9
View File
@@ -1,5 +1,5 @@
import { exportDay, planExportDependencies } from './exportFields.js';
import { jiraApiClient, listCreateIssueTypes } from './apiImport/jira.js';
import { jiraApiClient, listCreateIssueTypes, listJiraCloudCreateHierarchy } from './apiImport/jira.js';
import { jiraCloudDescription, jiraDataCenterDescription } from './jiraDescriptionWriteBack.js';
import { jiraWikiToMarkdown } from './jiraWikiMarkup.js';
import { cardParentIds } from './cardParents.js';
@@ -27,7 +27,7 @@ async function availableCreateFields({ cloud, get }, projectKey, issueTypeId, re
(Array.isArray(metadata.operations) && metadata.operations.includes('set'));
if (optionFields.has(field) && requested.has(field) && canSet && Array.isArray(metadata.allowedValues)) {
available.set(field, metadata.allowedValues);
} else if (!optionFields.has(field) && field !== 'startDate' && requested.has(field) && (field !== 'timetracking' || canSet)) {
} else if (!optionFields.has(field) && field !== 'startDate' && requested.has(field) && (!['timetracking', 'parent'].includes(field) || canSet)) {
available.set(field, field);
}
if (wantsStart && /^customfield_[1-9]\d{0,15}$/.test(field || '') &&
@@ -142,23 +142,92 @@ function planJiraSubtasks(cards, subtaskTypeId) {
if (parentOf.has(index)) order.add(parentOf.get(index));
order.add(index);
}
return { parentOf, order: [...order],
return { parentOf, order: [...order], parents,
skippedParents: parentIds.reduce((count, ids) => count + ids.length, 0) - parentOf.size };
}
async function planJiraCloudHierarchy(cards, fallback, levels, issueTypeId, subtaskTypeId, canSetParent) {
const typesByLevel = new Map([[-1, [subtaskTypeId]], [0, [issueTypeId]]]);
for (const { id, hierarchyLevel } of levels) {
if (hierarchyLevel < 1) continue;
if (!typesByLevel.has(hierarchyLevel)) typesByLevel.set(hierarchyLevel, []);
typesByLevel.get(hierarchyLevel).push(id);
}
const parentOf = new Map(fallback.parentOf);
const sourceParents = new Map(fallback.parents.map(({ index, parent }) => [index, parent]));
const roots = new Map();
for (const index of sourceParents.keys()) {
let root = index;
let depth = 0;
while (sourceParents.has(root)) {
root = sourceParents.get(root);
depth += 1;
}
if (!roots.has(root)) roots.set(root, []);
roots.get(root).push({ index, depth });
}
const types = new Map();
for (const [root, descendants] of roots) {
const rootLevel = descendants.reduce((max, { depth }) => Math.max(max, depth - 1), 0);
if (!rootLevel || rootLevel >= typesByLevel.size) continue;
const typeAt = [];
for (let level = 0; level <= rootLevel; level += 1) {
const candidates = typesByLevel.get(level);
if (candidates?.length !== 1 || (level < rootLevel && !await canSetParent(candidates[0]))) break;
typeAt.push(candidates[0]);
}
if (typeAt.length !== rootLevel + 1) continue;
types.set(root, typeAt[rootLevel]);
for (const { index, depth } of descendants) {
parentOf.set(index, sourceParents.get(index));
types.set(index, typeAt[rootLevel - depth] || subtaskTypeId);
}
}
if (!types.size) return fallback;
const order = new Set();
for (const index of cards.keys()) {
const ancestors = [];
for (let cursor = index; cursor !== undefined && !order.has(cursor); cursor = parentOf.get(cursor)) ancestors.push(cursor);
for (const ancestor of ancestors.reverse()) order.add(ancestor);
}
return { parentOf, types, order: [...order],
skippedParents: cards.reduce((count, card) => count + cardParentIds(card).length, 0) - parentOf.size };
}
export async function createJiraIssues(credentials, projectKey, issueTypeId, cards, request, subtaskTypeId) {
if (typeof projectKey !== 'string' || !/^[A-Z][A-Z0-9_]{0,99}$/i.test(projectKey)) throw new Error('Choose a Jira project');
if (typeof issueTypeId !== 'string' || !/^[1-9]\d{0,15}$/.test(issueTypeId)) throw new Error('Choose a Jira issue type');
if (subtaskTypeId && (subtaskTypeId === issueTypeId || !/^[1-9]\d{0,15}$/.test(subtaskTypeId))) {
throw new Error('Choose a Jira subtask type');
}
const { parentOf, order, skippedParents } = planJiraSubtasks(cards, subtaskTypeId);
let hierarchy = planJiraSubtasks(cards, subtaskTypeId);
const client = jiraApiClient(credentials, request);
const { cloud, post } = client;
if (hierarchy.parentOf.size) {
const createTypes = await listCreateIssueTypes(credentials, projectKey, request, true);
if (!createTypes.some(type => type.id === subtaskTypeId && type.subtask)) throw new Error('Choose a Jira subtask type');
const children = new Set(hierarchy.parents.map(({ index }) => index));
if (cloud && hierarchy.parents.some(({ parent }) => children.has(parent))) {
const levels = await listJiraCloudCreateHierarchy(client, projectKey, createTypes);
if (levels.some(type => type.id === issueTypeId && type.hierarchyLevel === 0) &&
levels.some(type => type.id === subtaskTypeId && type.hierarchyLevel === -1)) {
const parentFields = new Map();
async function canSetParent(typeId) {
if (!parentFields.has(typeId)) {
const fields = await availableCreateFields(client, projectKey, typeId, new Set(['parent']));
parentFields.set(typeId, fields.has('parent'));
}
return parentFields.get(typeId);
}
hierarchy = await planJiraCloudHierarchy(cards, hierarchy, levels, issueTypeId, subtaskTypeId, canSetParent);
}
}
}
const { parentOf, order, skippedParents } = hierarchy;
const base = `/rest/api/${cloud ? '3' : '2'}`;
const requestedByType = new Map();
const requests = cards.map(({ cardId, title, description, dueAt, startAt, labelNames, timetracking }, index) => {
const typeId = parentOf.has(index) ? subtaskTypeId : issueTypeId;
const typeId = hierarchy.types?.get(index) || (parentOf.has(index) ? subtaskTypeId : issueTypeId);
if (!requestedByType.has(typeId)) requestedByType.set(typeId, new Set());
const requested = requestedByType.get(typeId);
const summary = typeof title === 'string' ? title.trim() : '';
@@ -201,10 +270,6 @@ export async function createJiraIssues(credentials, projectKey, issueTypeId, car
return { cardId, fields, typeId, startDate, selectedOptions, skippedEstimates, names };
});
if (parentOf.size) {
const types = await listCreateIssueTypes(credentials, projectKey, request, true);
if (!types.some(type => type.id === subtaskTypeId && type.subtask)) throw new Error('Choose a Jira subtask type');
}
const availableByType = new Map();
for (const [typeId, requested] of requestedByType) {
availableByType.set(typeId, requested.size
+105 -16
View File
@@ -1,6 +1,6 @@
'use strict';
const { jiraAdfDateIso, jiraAdfStatusAttributes, jiraAdfMentionAttributes, jiraAdfMentionFallback, jiraAdfEmojiAttributes, jiraAdfExpandTitle } = require('./jiraWikiMarkup');
const { jiraAdfDateIso, jiraAdfStatusAttributes, jiraAdfMentionAttributes, jiraAdfMentionFallback, jiraAdfEmojiAttributes, jiraAdfExpandTitle, jiraAdfExpandMedia, jiraAdfPanelTypes, jiraAdfPanelBlocks, jiraCodeMacroLanguage } = require('./jiraWikiMarkup');
const MarkdownItModule = require('markdown-it');
const MarkdownIt = MarkdownItModule.default || MarkdownItModule;
const parser = new MarkdownIt({ html: true, breaks: true });
@@ -32,10 +32,17 @@ function supportedLinkTitle(title) {
// Replacing a structured description with only its readable text would lose
// information from Jira, even when the readable text matches the baseline.
function assertEditableAdf(value, inlineCards) {
function assertEditableAdf(value, inlineCards, mediaByExpand) {
if (value === null) return;
if (value?.type !== 'doc' || value.version !== 1 || !Array.isArray(value.content)) unsupported();
for (const block of value.content) {
if (block?.type === 'panel') {
if (!jiraAdfPanelTypes.includes(block.attrs?.panelType) || Object.keys(block.attrs).length !== 1 ||
block.marks?.length || !Array.isArray(block.content) || !block.content.length ||
block.content.some(child => !jiraAdfPanelBlocks.includes(child?.type))) unsupported();
for (const child of block.content) assertEditableBlock(child, inlineCards);
continue;
}
if (block?.type !== 'expand') {
assertEditableBlock(block, inlineCards);
continue;
@@ -44,8 +51,13 @@ function assertEditableAdf(value, inlineCards) {
if (!attrs || block.marks?.length || Object.keys(attrs).some(key => key !== 'title') ||
(Object.hasOwn(attrs, 'title') && jiraAdfExpandTitle(attrs) === undefined) ||
!Array.isArray(block.content) || !block.content.length ||
block.content.some(child => !expandBlocks.includes(child?.type))) unsupported();
for (const child of block.content) assertEditableBlock(child, inlineCards);
block.content.some(child => !expandBlocks.includes(child?.type) && !jiraAdfExpandMedia(child))) unsupported();
const media = [];
for (const child of block.content) {
if (jiraAdfExpandMedia(child)) media.push(child);
else assertEditableBlock(child, inlineCards);
}
mediaByExpand.push(media);
}
}
@@ -312,7 +324,21 @@ function readJiraTableCell(tokens, inlineCards) {
return blocks;
}
function markdownToAdf(markdown, { wiki = false, inlineCards } = {}) {
function wikiMacroFence(info) {
const match = /^([a-z0-9_+.#-]{1,32}) jira-macro:(\S+)$/.exec(info || '');
if (!match) return undefined;
let options;
try {
options = decodeURIComponent(match[2]);
} catch {
unsupported();
}
const macro = match[1] === 'noformat' ? 'noformat' : 'code';
if (jiraCodeMacroLanguage(options, macro) !== match[1] || encodeURIComponent(options) !== match[2]) unsupported();
return { language: match[1], wikiMacroOptions: options };
}
function markdownToAdf(markdown, { wiki = false, inlineCards, mediaByExpand = [] } = {}) {
if (!markdown.trim()) return null;
const tokens = parser.parse(markdown, {});
let index = 0;
@@ -348,27 +374,67 @@ function markdownToAdf(markdown, { wiki = false, inlineCards } = {}) {
return table;
}
function readBlocks(endType, inExpand = false) {
let expandIndex = 0;
let restoredMedia = 0;
function readBlocks(endType, inExpand = false, media = []) {
let nextMedia = 0;
const content = [];
while (index < tokens.length && tokens[index].type !== endType) {
const token = tokens[index++];
const expand = !wiki && !endType && !inExpand && token.type === 'html_block' &&
/^<details data-jira-expand="true">(?:<summary>([^<]*)<\/summary>)?$/.exec(token.content.trim());
if (expand) {
const panel = wiki && !endType && token.type === 'html_block' &&
/^<!-- jira-panel:(\S*) -->$/.exec(token.content.trim());
const cloudPanel = !wiki && !endType && !inExpand && token.type === 'html_block' &&
/^<div data-jira-panel="([a-z]+)">$/.exec(token.content.trim());
if (cloudPanel) {
const panelType = cloudPanel[1];
if (!jiraAdfPanelTypes.includes(panelType)) unsupported();
const body = readBlocks('jira_cloud_panel_close');
if (!body.length || body.some(child => !jiraAdfPanelBlocks.includes(child.type))) unsupported();
content.push({ type: 'panel', attrs: { panelType }, content: body });
} else if (endType === 'jira_cloud_panel_close' && token.type === 'html_block' &&
token.content.trim() === '</div>') {
return content;
} else if (panel) {
let options;
try {
options = decodeURIComponent(panel[1]);
} catch {
unsupported();
}
if (encodeURIComponent(options) !== panel[1] ||
(options && !jiraCodeMacroLanguage(options, 'noformat'))) unsupported();
const body = readBlocks('jira_panel_close');
if (!body.length) unsupported();
content.push({ type: 'wikiPanel', attrs: { options }, content: body });
} else if (endType === 'jira_panel_close' && token.type === 'html_block' &&
token.content.trim() === '<!-- /jira-panel -->') {
return content;
} else if (expand) {
const attrs = {};
if (expand[1] !== undefined) {
attrs.title = expand[1].replace(/&(?:amp|lt|gt);/g, entity => parser.utils.unescapeAll(entity));
if (jiraAdfExpandTitle(attrs) === undefined) unsupported();
}
const body = readBlocks(undefined, true);
if (body.some(child => !expandBlocks.includes(child.type))) unsupported();
const body = readBlocks(undefined, true, mediaByExpand[expandIndex++] || []);
if (body.some(child => !expandBlocks.includes(child.type) && !jiraAdfExpandMedia(child))) unsupported();
content.push({ type: 'expand', attrs, content: body.length ? body : [{ type: 'paragraph' }] });
} else if (inExpand && token.type === 'html_block' && token.content.trim() === '</details>') {
if (nextMedia !== media.length) unsupported();
return content;
} else if (token.type === 'paragraph_open' || token.type === 'heading_open') {
const type = token.type === 'heading_open' ? 'heading' : 'paragraph';
const inline = tokens[index++];
if (inline?.type !== 'inline' || tokens[index++]?.type !== type + '_close') unsupported();
const marker = !wiki && type === 'paragraph' && inline.children?.length === 1 &&
inline.children[0].type === 'code_inline' && /^\[Jira media ([1-9]\d*)\]$/.exec(inline.children[0].content);
if (marker) {
if (!inExpand || Number(marker[1]) !== nextMedia + 1 || !media[nextMedia]) unsupported();
content.push(structuredClone(media[nextMedia++]));
restoredMedia += 1;
continue;
}
content.push({
type,
...(type === 'heading' ? { attrs: { level: Number(token.tag.slice(1)) } } : {}),
@@ -378,10 +444,11 @@ function markdownToAdf(markdown, { wiki = false, inlineCards } = {}) {
content.push({ type: 'paragraph', content: [{ type: 'hardBreak' }] });
} else if (token.type === 'fence' || token.type === 'code_block') {
const language = token.info?.trim();
if (language && !safeLanguage.test(language)) unsupported();
const attrs = wiki && wikiMacroFence(language);
if (!attrs && language && !safeLanguage.test(language)) unsupported();
content.push({
type: 'codeBlock',
...(language ? { attrs: { language } } : {}),
...(language ? { attrs: attrs || { language } } : {}),
...(token.content ? { content: [{ type: 'text', text: token.content }] } : {}),
});
} else if (token.type === 'table_open') {
@@ -417,13 +484,16 @@ function markdownToAdf(markdown, { wiki = false, inlineCards } = {}) {
if (endType && tokens[index++]?.type !== endType) unsupported();
return content;
}
return { type: 'doc', version: 1, content: readBlocks() };
const content = readBlocks();
if (restoredMedia !== mediaByExpand.reduce((count, media) => count + media.length, 0)) unsupported();
return { type: 'doc', version: 1, content };
}
function jiraCloudDescription(markdown, previous) {
const inlineCards = new Map();
assertEditableAdf(previous, inlineCards);
return markdownToAdf(markdown, { inlineCards });
const mediaByExpand = [];
assertEditableAdf(previous, inlineCards, mediaByExpand);
return markdownToAdf(markdown, { inlineCards, mediaByExpand });
}
function wikiInline(nodes, { table = false } = {}) {
@@ -511,6 +581,10 @@ function markdownToWiki(markdown) {
}
function wikiBlock(block) {
if (block.type === 'wikiPanel') {
const { options } = block.attrs;
return `{panel${options ? ':' + options : ''}}\n${block.content.map(wikiBlock).join('\n\n')}\n{panel}`;
}
if (block.type === 'bulletList' || block.type === 'orderedList') return wikiList(block);
if (block.type === 'rule') return '----';
if (block.type === 'table') return wikiTable(block);
@@ -523,6 +597,12 @@ function wikiBlock(block) {
if (block.type === 'codeBlock') {
const text = block.content?.[0]?.text || '';
const language = block.attrs?.language;
const options = block.attrs?.wikiMacroOptions;
if (options) {
const macro = language === 'noformat' ? 'noformat' : 'code';
if (text.includes(`{${macro}}`)) unsupported();
return `{${macro}:${options}}\n${text}{${macro}}`;
}
if (language === 'noformat') {
if (/\{noformat(?::[^}]*)?\}/.test(text)) unsupported();
return `{noformat}\n${text}{noformat}`;
@@ -537,8 +617,17 @@ function wikiBlock(block) {
function jiraDataCenterDescription(markdown, previous, readWiki) {
// A wiki field may contain macros and effects that have no Markdown
// equivalent. Require the existing representation to survive the round trip.
if (previous !== null && (typeof previous !== 'string' ||
(markdownToWiki(readWiki(previous)) || '') !== previous.replace(/\r\n?/g, '\n'))) unsupported();
if (previous !== null) {
if (typeof previous !== 'string') unsupported();
const previousMarkdown = readWiki(previous);
if ((markdownToWiki(previousMarkdown) || '') !== previous.replace(/\r\n?/g, '\n')) unsupported();
const macroInfos = value => parser.parse(value, {}).flatMap(token => {
if (token.type === 'fence' && wikiMacroFence(token.info.trim())) return [token.info.trim()];
if (token.type === 'html_block' && /^<!-- jira-panel:\S* -->$/.test(token.content.trim())) return [token.content.trim()];
return [];
});
if (JSON.stringify(macroInfos(previousMarkdown)) !== JSON.stringify(macroInfos(markdown))) unsupported();
}
return markdownToWiki(markdown);
}
+53 -1
View File
@@ -98,6 +98,28 @@ function tableRow(line, keep) {
return { header, cells };
}
// Keep only documented plain-text options. They are encoded in fence
// metadata, never emitted as HTML or interpreted as styling by WeKan.
export function jiraCodeMacroLanguage(options, macro) {
if (typeof options !== 'string' || options.length > 512 || !options.includes('=') || !options.isWellFormed()) return false;
const seen = new Set();
const parts = options.split('|');
let language = macro === 'noformat' ? 'noformat' : 'text';
if (macro === 'code' && /^[a-z0-9_+.#-]{1,32}$/i.test(parts[0]) && parts[0].toLowerCase() !== 'noformat') {
language = parts.shift().toLowerCase();
}
for (const part of parts) {
const match = /^(title|borderStyle|borderWidth|borderColor|bgColor|titleBGColor)=([^{}<>\x00-\x1f\x7f]+)$/.exec(part);
if (!match || seen.has(match[1])) return false;
const [, name, value] = match;
if (name === 'borderStyle' && !/^(?:solid|dashed|dotted|double|none)$/.test(value)) return false;
if (name === 'borderWidth' && !/^\d{1,2}(?:px)?$/.test(value)) return false;
if (name.endsWith('Color') && !/^#(?:[a-f0-9]{3}|[a-f0-9]{6})$/i.test(value)) return false;
seen.add(name);
}
return language;
}
export function jiraWikiToMarkdown(value) {
if (typeof value !== 'string' || !value) return '';
const kept = [];
@@ -108,6 +130,11 @@ export function jiraWikiToMarkdown(value) {
let text = value.replace(/\r\n?/g, '\n');
// Blocks whose content is literal, first.
text = text.replace(/\{(code|noformat)(?::([^}]*))?\}([\s\S]*?)\{\1\}/g, (all, macro, options, body) => {
const language = jiraCodeMacroLanguage(options, macro);
if (language) {
const info = language + ' jira-macro:' + encodeURIComponent(options);
return `\n${keep(fence(body.replace(/^\n/, ''), info, { preserveBlankLines: true }))}\n`;
}
if (macro === 'noformat') {
const block = options === undefined
? fence(body.replace(/^\n/, ''), 'noformat', { preserveBlankLines: true })
@@ -128,6 +155,12 @@ export function jiraWikiToMarkdown(value) {
.split('\n').map(line => line ? `> ${line}` : '>').join('\n');
return `\n${keep(quote)}\n`;
});
text = text.replace(/\{panel(?::([^}]*))?\}\n([\s\S]*?)\n\{panel\}/g, (all, options, body) => {
if (options !== undefined && !jiraCodeMacroLanguage(options, 'noformat')) return all;
const content = restore(wikiBlocks(body, keep)).trim();
if (!content) return all;
return `\n${keep(`<!-- jira-panel:${encodeURIComponent(options || '')} -->\n\n${content}\n\n<!-- /jira-panel -->`)}\n`;
});
return restore(wikiBlocks(text, keep)).replace(/\n{3,}/g, '\n\n').replace(/^\n+|\n+$/g, '');
}
@@ -393,9 +426,21 @@ export function jiraAdfExpandTitle(attrs) {
return typeof attrs?.title === 'string' && !/[\x00-\x1f\x7f]/.test(attrs.title) ? attrs.title : undefined;
}
export function jiraAdfExpandMedia(node) {
return ['mediaSingle', 'mediaGroup'].includes(node?.type) && Array.isArray(node.content) &&
node.content.length > 0 && (node.type !== 'mediaSingle' || node.content.length === 1) &&
node.content.every(child => child?.type === 'media' && typeof child.attrs?.id === 'string');
}
export const jiraAdfPanelTypes = Object.freeze(['info', 'note', 'warning', 'success', 'error']);
export const jiraAdfPanelBlocks = Object.freeze(['paragraph', 'heading', 'bulletList', 'orderedList']);
const expandMediaMarker = Symbol();
// Convert Markdown-capable nodes before the plain reader joins the document.
function adfWithMarkdown(node, readText, alternateListMarker = false) {
if (!node || typeof node !== 'object') return node;
if (node[expandMediaMarker]) return { type: 'text', text: node[expandMediaMarker] };
if (node.type === 'mention' || node.type === 'emoji') {
const isMention = node.type === 'mention';
const attrs = isMention ? jiraAdfMentionAttributes(node.attrs) : jiraAdfEmojiAttributes(node.attrs);
@@ -448,7 +493,14 @@ function adfWithMarkdown(node, readText, alternateListMarker = false) {
const list = adfListToMarkdown(node, readText, alternateListMarker);
return { type: 'text', text: `\n${list}\n\n` };
}
const content = adfMarkdownContent(node.content, readText);
let mediaIndex = 0;
const children = node.type === 'expand' ? node.content.map(child => jiraAdfExpandMedia(child)
? { [expandMediaMarker]: '\x60[Jira media ' + (++mediaIndex) + ']\x60' } : child) : node.content;
const content = adfMarkdownContent(children, readText);
if (node.type === 'panel' && jiraAdfPanelTypes.includes(node.attrs?.panelType)) {
const body = content.map(child => readText(child).replace(/^\n+|\n+$/g, '')).join('\n\n');
return { type: 'text', text: `\n<div data-jira-panel="${node.attrs.panelType}">\n\n${body}\n\n</div>\n\n` };
}
if (node.type === 'expand') {
const title = jiraAdfExpandTitle(node.attrs);
const html = { '&': '&amp;', '<': '&lt;', '>': '&gt;' };
+11 -1
View File
@@ -16,6 +16,16 @@ function listEntryOptions(fields) {
];
}
function remapListEntryRequirements(requirements, customFields) {
if (!Array.isArray(requirements)) return [];
return [...new Set(requirements.flatMap(id => {
if (typeof id !== 'string') return [];
if (Object.hasOwn(DATES, id)) return [id];
const sourceId = id.startsWith('custom:') && id.slice(7);
return sourceId && Object.hasOwn(customFields, sourceId) ? [customKey(customFields[sourceId])] : [];
}))].slice(0, 100);
}
function hasValue(value) {
if (typeof value === 'string') return value.trim() !== '';
if (Array.isArray(value)) return value.some(hasValue);
@@ -36,4 +46,4 @@ function missingListEntryFields(list, card, definitions) {
});
}
module.exports = { listEntryOptions, missingListEntryFields };
module.exports = { listEntryOptions, missingListEntryFields, remapListEntryRequirements };
+10 -3
View File
@@ -13,10 +13,16 @@ function addIssueDueDates(type, raw, tasks, syncField = 'dueDate') {
// OpenProject milestones expose "date" instead of "dueDate", including null.
const fields = jira ? issue.fields : issue;
let field = syncField;
if (jira) field = 'duedate';
if (jira) {
field = syncField === 'startDate' ? raw.jiraStartDateFieldId : 'duedate';
if (syncField === 'startDate' && !/^customfield_[1-9]\d{0,15}$/.test(field || '')) continue;
}
else if (redmine) field = syncField === 'startDate' ? 'start_date' : 'due_date';
else if (type === 'openproject' && Object.hasOwn(issue, 'date')) {
if (syncField === 'startDate') continue;
if (syncField === 'startDate') {
dates.set(String(issue.id), '');
continue;
}
field = 'date';
}
const date = fields?.[field];
@@ -27,7 +33,8 @@ function addIssueDueDates(type, raw, tasks, syncField = 'dueDate') {
dates.set(String(jira ? issue.key : issue.id), date ?? '');
}
return tasks.map(task => dates.has(String(task.externalId))
? { ...task, [syncField]: dates.get(String(task.externalId)) } : task);
? { ...task, [syncField]: dates.get(String(task.externalId)),
...(jira && syncField === 'startDate' ? { startDateMapping: raw.jiraStartDateFieldId } : {}) } : task);
}
function asanaDate(task, field) {
+4
View File
@@ -22,6 +22,10 @@ function planSyncTextMerge(tasks, cards, estimateMapping = null, timeMappings =
const card = byId.get(String(task.externalId));
if (!card) return task;
const result = { ...task }, baseline = { ...(card.syncLastSource || {}) };
if (task.startDateMapping && baseline.startDateMapping !== task.startDateMapping) {
delete baseline.startDate;
baseline.startDateMapping = task.startDateMapping;
}
if (estimateMapping && baseline.estimateMapping !== estimateMapping.identity) {
delete baseline.estimate;
baseline.estimateMapping = estimateMapping.identity;
+1 -1
View File
@@ -64,7 +64,7 @@ function syncTimeMappings(source, definitions = [], estimateMapping = null) {
const identityUnit = field === 'duration' ? 'duration' : openProject?.unit || 'hours';
mappings[field] = openProject
? { ...openProject, localFieldId, identity: JSON.stringify([localFieldId, openProject.remote, identityUnit]),
...(['status', 'priority'].includes(field) && matches[0].readOnly ? { openProjectReadOnly: true } : {}) }
...(['status', 'priority', 'type', 'budget'].includes(field) && matches[0].readOnly ? { openProjectReadOnly: true } : {}) }
: { ...spec, localFieldId, ...(matches[0].adminOnly || matches[0].readOnly ? { jiraReadOnly: true } : {}), identity: JSON.stringify([localFieldId, spec.key, 'hours']) };
}
return mappings;
+2
View File
@@ -1,3 +1,5 @@
export const MAX_NOTION_IMPORT_MARKDOWN_BYTES = 7 * 1024 * 1024;
const NOTION_ID = /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i;
export function isNotionId(value) {
+252 -23
View File
@@ -1,18 +1,35 @@
import { openProjectApiHeaders } from './apiImport/openproject.js';
import { openProjectApiHeaders, openProjectBudgetLinks } from './apiImport/openproject.js';
import { planImportedLinks } from './importedTaskPlan.js';
import { cardParentIds } from './cardParents.js';
import { STORY_POINTS_FIELD } from './externalScrumPlanning.js';
import { exportDay, planExportDependencies } from './exportFields.js';
import openProjectDurations from './openProjectDurations.js';
import openProjectVersions from './openProjectVersions.js';
const { OPENPROJECT_TIME_FIELDS, OPENPROJECT_PROGRESS_FIELD } = openProjectDurations;
const { OPENPROJECT_TIME_FIELDS, OPENPROJECT_PROGRESS_FIELD, OPENPROJECT_BOOLEAN_FIELDS, OPENPROJECT_TEXT_FIELDS, OPENPROJECT_MILESTONE_FIELD } = openProjectDurations;
const workFields = [...Object.values(OPENPROJECT_TIME_FIELDS), OPENPROJECT_PROGRESS_FIELD];
const linkedFields = {
budget: /^\/api\/v3\/budgets\/[1-9]\d*$/,
type: /^\/api\/v3\/types\/[1-9]\d*$/,
status: /^\/api\/v3\/statuses\/[1-9]\d*$/,
priority: /^\/api\/v3\/priorities\/[1-9]\d*$/,
};
const workFields = [
...Object.values(OPENPROJECT_TIME_FIELDS).map(field => ({ ...field, type: 'number' })),
{ ...OPENPROJECT_PROGRESS_FIELD, type: 'number' },
{ remote: 'storyPoints', name: STORY_POINTS_FIELD, type: 'number' },
{ remote: 'milestone', name: OPENPROJECT_MILESTONE_FIELD, type: 'checkbox' },
{ remote: 'duration', name: OPENPROJECT_TEXT_FIELDS.duration.name, type: 'text' },
{ remote: 'ignoreNonWorkingDays', name: OPENPROJECT_BOOLEAN_FIELDS.ignoreNonWorkingDays, type: 'checkbox' },
{ remote: 'scheduleManually', name: OPENPROJECT_BOOLEAN_FIELDS.scheduleManually, type: 'checkbox' },
...Object.keys(linkedFields).map(remote => ({ remote, name: OPENPROJECT_TEXT_FIELDS[remote].name, type: 'text' })),
];
export function openProjectExportWorkFields(definitions) {
const mappings = new Map();
for (const { name, remote } of workFields) {
const matches = definitions.filter(field => field.type === 'number' && field.name === name);
for (const { name, remote, type } of workFields) {
const matches = definitions.filter(field => field.type === type && field.name === name);
if (matches.length === 1 && !matches[0].adminOnly) mappings.set(remote, matches[0]._id);
}
return mappings;
@@ -22,30 +39,148 @@ export function openProjectExportWorkValues(card, mappings) {
const values = {};
for (const [remote, id] of mappings) {
const entries = (card.customFields || []).filter(entry => entry._id === id);
if (entries.length === 1 && typeof entries[0].value === 'number') values[remote] = entries[0].value;
if (entries.length === 1) values[remote] = entries[0].value;
}
return values;
}
function exportWorkPayload(values = {}) {
const labelCollections = {
targetVersions: { prefix: 'version:', legacy: 'version', path: /^\/api\/v3\/versions\/[1-9]\d*$/ },
observedInVersions: { prefix: openProjectVersions.OPENPROJECT_OBSERVED_VERSION_PREFIX, path: /^\/api\/v3\/versions\/[1-9]\d*$/ },
categories: { prefix: 'OpenProject category: ', legacy: 'category', path: /^\/api\/v3\/categories\/[1-9]\d*$/ },
labels: { prefix: openProjectVersions.OPENPROJECT_LABEL_PREFIX, path: /^\/api\/v3\/labels\/[1-9]\d*$/ },
projectPhase: { prefix: 'OpenProject phase: ', single: true, path: /^\/api\/v3\/project_phases\/[1-9]\d*$/ },
};
export function openProjectExportLabelValues(labelNames) {
const values = {};
for (const [field, { prefix }] of Object.entries(labelCollections)) {
const names = [...new Set((labelNames || []).filter(name => typeof name === 'string' && name.startsWith(prefix))
.map(name => name.slice(prefix.length).trim()).filter(Boolean))];
if (names.length) values[field] = names;
}
return values;
}
function exportWorkPayload(values = {}, { startDate, dueDate }) {
const payload = {};
let skipped = 0;
for (const field of Object.keys(labelCollections)) {
if (!Array.isArray(values[field]) || !values[field].length) continue;
if (values[field].every(OPENPROJECT_TEXT_FIELDS.priority.valid)) payload[field] = values[field];
else skipped += 1;
}
let automatic = false;
for (const { remote } of workFields) {
if (!Object.hasOwn(values, remote)) continue;
const value = values[remote];
if (remote === OPENPROJECT_PROGRESS_FIELD.remote) {
if (Object.hasOwn(linkedFields, remote)) {
if (OPENPROJECT_TEXT_FIELDS[remote].valid(value)) payload[remote] = value;
else skipped += 1;
} else if (remote === 'duration') {
// Let the destination derive duration when both calendar dates are supplied.
if (!(startDate && dueDate) && OPENPROJECT_TEXT_FIELDS.duration.valid(value)) payload[remote] = value;
else skipped += 1;
} else if (remote === 'milestone') {
if (value === true) payload.milestone = true;
else if (value !== false) skipped += 1;
} else if (remote === 'scheduleManually' && value === false) {
automatic = true;
} else if (remote === 'ignoreNonWorkingDays' || remote === 'scheduleManually') {
if (typeof value === 'boolean') payload[remote] = value;
else skipped += 1;
} else if (remote === 'storyPoints') {
if (Number.isSafeInteger(value) && value >= 0 && value <= 1e12) payload[remote] = value;
else skipped += 1;
} else if (remote === OPENPROJECT_PROGRESS_FIELD.remote) {
if (Number.isInteger(value) && value >= 0 && value <= 100) payload[remote] = value;
else skipped += 1;
} else {
} else if (typeof value === 'number' && value >= 0 && value <= 1e12) {
const seconds = Math.round(value * 3600);
if (typeof value === 'number' && value >= 0 && value <= 1e12 && Number.isSafeInteger(seconds) &&
Math.abs(seconds / 3600 - value) <= Number.EPSILON * Math.max(1, value)) payload[remote] = `PT${seconds}S`;
else skipped += 1;
}
if (Number.isSafeInteger(seconds) && Math.abs(seconds / 3600 - value) <= Number.EPSILON * Math.max(1, value)) {
payload[remote] = `PT${seconds}S`;
} else skipped += 1;
} else skipped += 1;
}
return { payload, skipped };
return { payload, skipped, automatic };
}
function allowedWorkLink(value, property, path, titleField = 'name') {
if (property?.writable !== true) return undefined;
const links = property._links?.allowedValues;
const embedded = property._embedded?.allowedValues;
const candidates = [
...(Array.isArray(links) ? links : []),
...(Array.isArray(embedded) ? embedded.map(item => ({ title: item?.[titleField], href: item?._links?.self?.href })) : []),
];
const matched = new Set(candidates.filter(link => link?.title === value &&
typeof link.href === 'string' && path.test(link.href)).map(link => link.href));
return matched.size === 1 ? { href: matched.values().next().value } : undefined;
}
function applyWorkField(body, field, value, schema) {
const collection = labelCollections[field];
if (collection) {
const target = collection.legacy && schema?.[field]?.writable !== true ? collection.legacy : field;
const single = collection.single || target !== field;
if (single && value.length !== 1) return false;
const links = value.map(name => allowedWorkLink(name, schema?.[target], collection.path));
if (links.some(link => !link)) return false;
(body._links ||= {})[target] = single ? links[0] : links;
return true;
}
if (schema?.[field]?.writable !== true) return false;
const path = linkedFields[field];
if (!path) {
body[field] = value;
return true;
}
const link = allowedWorkLink(value, schema[field], path, field === 'budget' ? 'subject' : 'name');
if (!link) return false;
(body._links ||= {})[field] = link;
return true;
}
async function readWorkspaceChoices(request, base, path, headers, identify) {
const elements = [];
const pageSize = 100;
const ids = new Set();
let total;
for (let offset = 1; offset <= 100; offset += 1) {
const query = new URLSearchParams({ offset, pageSize });
const page = await request(`${base}${path}?${query}`, { method: 'GET', headers });
const rows = page?._embedded?.elements;
if (page?._type !== 'Collection' || page.offset !== offset || !Array.isArray(rows) ||
rows.length > pageSize || !Number.isSafeInteger(page.total) || page.total < elements.length + rows.length ||
(total !== undefined && total !== page.total)) return undefined;
total = page.total;
for (const row of rows) {
const key = identify(row);
if (!key || ids.has(key)) return undefined;
ids.add(key);
}
elements.push(...rows);
if (elements.length === page.total) return elements;
if (rows.length === 0) return undefined;
}
return undefined;
}
async function confirmsMultipleVersions(request, formUrl, headers, body) {
try {
const form = await request(formUrl, { method: 'POST', headers, body });
if (form?._type !== 'Form') return false;
const { validationErrors, payload } = form._embedded || {};
const confirmed = payload?._links?.targetVersions;
const submitted = body._links.targetVersions;
if (Object.keys(validationErrors || {}).length || !Array.isArray(confirmed) ||
confirmed.length !== submitted.length) return false;
const hrefs = new Set(confirmed.map(link => link?.href));
return submitted.every(({ href }) => hrefs.has(href));
} catch {
return false;
}
}
function requestFailure(error) {
const status = Number.isSafeInteger(error?.status) ? error.status : 0;
@@ -77,6 +212,26 @@ async function createRelations(credentials, headers, cards, createdIds, request)
return { createdDependencies, skippedDependencies };
}
async function applyAutomaticScheduling(base, headers, id, request) {
const url = `${base}/api/v3/work_packages/${id}`;
try {
const current = await request(url, { method: 'GET', headers });
if (current?._type !== 'WorkPackage' || current.id !== id) return false;
if (current.scheduleManually === false) return true;
if (!Number.isSafeInteger(current.lockVersion) || current.lockVersion < 0) return false;
const body = { lockVersion: current.lockVersion, scheduleManually: false };
const form = await request(`${url}/form`, { method: 'POST', headers, body });
if (form?._type !== 'Form' || form._embedded?.schema?.scheduleManually?.writable !== true ||
Object.keys(form._embedded?.validationErrors || {}).length) return false;
const updated = await request(url, { method: 'PATCH', headers, body });
return updated?._type === 'WorkPackage' && updated.id === id && updated.scheduleManually === false;
} catch {
// The exported package is already confirmed. Keep it and report the
// unconfirmed scheduling field without retrying a potentially applied write.
return false;
}
}
// The selected project comes from the API import client's project listing.
export async function createOpenProjectWorkPackages(credentials, projectId, cards, request) {
if (typeof projectId !== 'string' || !/^[1-9]\d{0,15}$/.test(projectId)) {
@@ -91,7 +246,8 @@ export async function createOpenProjectWorkPackages(credentials, projectId, card
const dueDate = exportDay(card.dueAt);
return {
cardId: card.cardId,
work: exportWorkPayload(card.workFields),
assigneeName: card.assigneeName,
work: exportWorkPayload(card.workFields, { startDate, dueDate }),
body: {
subject,
...(startDate ? { startDate } : {}),
@@ -122,27 +278,94 @@ export async function createOpenProjectWorkPackages(credentials, projectId, card
});
const created = [];
const createdIds = new Map();
const workspaceLabelsPath = `/api/v3/workspaces/${projectId}/labels`;
const assigneePaths = [`/api/v3/projects/${projectId}/available_assignees`,
`/api/v3/workspaces/${projectId}/available_assignees`];
const assigneeChoices = new Map();
const budgetPath = `/api/v3/projects/${projectId}/budgets`;
let budgetChoices;
let workspaceLabels;
for (const [position, index] of [...order].entries()) {
const { cardId, body, work } = requests[index];
const { cardId, body, work, assigneeName } = requests[index];
const parentId = createdIds.get(parentOf.get(index));
if (parentId !== undefined) body._links = { parent: { href: `/api/v3/work_packages/${parentId}` } };
let skipped = work.skipped;
const workKeys = Object.keys(work.payload);
if (workKeys.length) {
if (assigneeName === '') skipped += 1;
const { type, milestone, ...otherWork } = work.payload;
const workKeys = Object.keys(otherWork);
if (assigneeName) workKeys.push('assignee');
if (type !== undefined || milestone || workKeys.length) {
let form;
const { startDate, dueDate, ...undated } = body;
const formBody = () => milestone ? { ...undated, ...(body._links ? { _links: body._links } : {}) } : body;
try {
form = await request(`${target}/form`, { method: 'POST', headers, body });
form = await request(`${target}/form`, { method: 'POST', headers, body: formBody() });
if (type !== undefined) {
const typeProperty = form?._type === 'Form' ? form._embedded?.schema?.type : null;
if (!applyWorkField(body, 'type', type, { type: typeProperty })) skipped += 1;
else if (milestone || workKeys.length) {
form = await request(`${target}/form`, { method: 'POST', headers, body: formBody() });
}
}
} catch (error) {
if (![404, 405].includes(error.status)) {
if (body._links?.type || ![404, 405].includes(error.status)) {
return { created, stoppedAt: cardId, outcome: 'rejected', status: requestFailure(error).status,
remaining: requests.length - position - 1, ...omissions() };
}
if (type !== undefined) skipped += 1;
}
let schema = form?._type === 'Form' ? form._embedded?.schema : null;
if (milestone) {
if (schema?.date?.type === 'Date') {
delete body.startDate;
delete body.dueDate;
if (schema.date.writable === true && dueDate) body.date = dueDate;
if ((dueDate && !body.date) || (startDate && startDate !== body.date)) skipped += 1;
} else skipped += 1;
}
if (workKeys.includes('labels') && schema?.labels?.writable === true &&
schema.labels._links?.allowedValues?.href === workspaceLabelsPath) {
workspaceLabels ??= readWorkspaceChoices(request, credentials.url, workspaceLabelsPath, headers,
row => row?._type === 'Label' && row._links?.self?.href === `/api/v3/labels/${row.id}` &&
Number.isSafeInteger(row.id) && row.id > 0 && row.id).catch(() => undefined);
const allowedValues = await workspaceLabels;
if (allowedValues) schema = { ...schema, labels: { ...schema.labels, _embedded: { allowedValues } } };
}
if (workKeys.includes('budget') && schema?.budget?.writable === true &&
schema.budget._links?.allowedValues?.href === budgetPath) {
budgetChoices ??= request(credentials.url + budgetPath, { method: 'GET', headers })
.then(openProjectBudgetLinks).catch(() => undefined);
const allowedValues = await budgetChoices;
if (allowedValues) schema = { ...schema, budget: { ...schema.budget, _links: { allowedValues } } };
}
const schema = form?._type === 'Form' ? form._embedded?.schema : null;
for (const field of workKeys) {
if (schema?.[field]?.writable === true) body[field] = work.payload[field];
if (field !== 'assignee') {
if (!applyWorkField(body, field, otherWork[field], schema)) skipped += 1;
continue;
}
let property = schema?.assignee;
const path = property?._links?.allowedValues?.href;
if (property?.writable === true && assigneePaths.includes(path)) {
if (!assigneeChoices.has(path)) {
assigneeChoices.set(path, readWorkspaceChoices(request, credentials.url, path, headers, row => {
const href = row?._links?.self?.href;
return typeof href === 'string' && /^\/api\/v3\/(users|groups|placeholder_users)\/[1-9]\d*$/.test(href) && href;
}).catch(() => undefined));
}
const allowedValues = await assigneeChoices.get(path);
if (allowedValues) property = { ...property, _embedded: { allowedValues } };
}
const link = allowedWorkLink(assigneeName, property, /^\/api\/v3\/users\/[1-9]\d*$/);
if (link) (body._links ||= {}).assignee = link;
else skipped += 1;
}
// Some releases expose the array field but enforce one assignment.
if (body._links?.targetVersions?.length > 1 &&
!await confirmsMultipleVersions(request, `${target}/form`, headers, body)) {
delete body._links.targetVersions;
if (!Object.keys(body._links).length) delete body._links;
skipped += 1;
}
}
let result;
try {
@@ -158,10 +381,16 @@ export async function createOpenProjectWorkPackages(credentials, projectId, card
projectPath !== `/api/v3/workspaces/${projectId}`)) {
return { created, stoppedAt: cardId, outcome: 'unknown', status: 0, remaining: requests.length - position - 1, ...omissions() };
}
skippedWorkFields += skipped;
skippedWorkFields += skipped + Number(work.automatic);
created.push({ cardId, id: result.id });
createdIds.set(index, result.id);
}
const relations = await createRelations(credentials, headers, cards, createdIds, request);
// Automatic mode is validated only after parents, children and relations exist.
for (const [index, id] of createdIds) {
if (requests[index].work.automatic && await applyAutomaticScheduling(credentials.url, headers, id, request)) {
skippedWorkFields -= 1;
}
}
return { created, remaining: 0, ...omissions(), ...relations };
}
+3
View File
@@ -277,6 +277,8 @@ export function scopedExternalDocument(document, { includeScrum = true, includeL
? `#${tag.color}` : tag?.color });
labelIds.push(labels.get(name)._id);
}
const openProjectAssignee = sourceKey === 'openproject' && task.owner_username
? resolve(task.owner_username) : undefined;
cards.push({
_id: cardId, title: task.title, description: task.description, labelIds,
customFields: [...importedCustomFieldValues(task, fields).map(field => ({ _id: fieldIds.get(field.name), value: field.value })),
@@ -293,6 +295,7 @@ export function scopedExternalDocument(document, { includeScrum = true, includeL
color: task.color, recurrenceInterval: task.recurrence, worklogs: task.worklogs, requestedBy: task.requested_by,
assignedBy: task.assigned_by, isOvertime: task.isOvertime,
members: [...new Set(assignees.map(resolve).filter(Boolean))],
...(openProjectAssignee ? { assignees: [openProjectAssignee] } : {}),
watchers: [...new Set(watchers.map(resolve).filter(Boolean))],
scrum: task.scrum,
...(jira && task.jiraHistory?.length ? {
+1
View File
@@ -51,6 +51,7 @@ export const NOT_COPIED = {
syncMsTodoPreviousStatus: 'external sync bookkeeping',
syncArchivedFromSourceAt: 'external sync bookkeeping',
jiraIssueHistory: 'read-only Jira source history created through Jira import',
notionSyncedMemberIds: 'Notion Sync member ownership is rebuilt from the destination board and its Sync source',
jiraSyncedVoterIds: 'read-only board member IDs mapped from a Jira voter snapshot',
openProjectTimeEntries: 'read-only data fetched with the configured OpenProject credentials',
openProjectTimeEntriesOmitted: 'count for time entries fetched with the configured OpenProject credentials',
+3 -3
View File
@@ -28,7 +28,6 @@ export const RECORDS = {
copied: ['wipLimit', 'policy', 'split', 'cardsUseListColor', 'starred'],
notCopied: {
deletedAt: TRASH, deletedBy: TRASH, deleteBatchId: TRASH,
entryRequirements: 'custom field IDs belong to the exporting board',
linkedBoardId: 'a board of the exporting WeKan', linkedListId: 'a list of another board of the exporting WeKan',
scrum: SCRUM, scrumRevision: SCRUM,
syncCredentialFence: SYNC, syncCredentialGeneration: SYNC, syncCredentialIncarnation: SYNC, syncRevision: SYNC,
@@ -38,14 +37,15 @@ export const RECORDS = {
swimlanes: { copied: ['height'], notCopied: { scrum: SCRUM, scrumRevision: SCRUM } },
checklists: {
copied: ['hideAllChecklistItems', 'hideCheckedChecklistItems', 'showChecklistAtMinicard', 'resetInterval'],
notCopied: {},
notCopied: { plankaRemoteId: SYNC, plankaCreateStartedAt: SYNC, plankaSyncSourceKey: SYNC, plankaSyncSort: SYNC, plankaSyncTitle: SYNC },
},
checklistItems: { copied: [], notCopied: {} },
checklistItems: { copied: [], notCopied: { plankaRemoteId: SYNC, plankaCreateStartedAt: SYNC, plankaSyncSourceKey: SYNC, plankaSyncSort: SYNC, plankaSyncTitle: SYNC, plankaSyncFinished: SYNC } },
customFields: { copied: ['adminOnly', 'readOnly', 'cardKinds', 'showSumAtTopOfList'], notCopied: {} },
cardComments: {
copied: [],
notCopied: {
syncCommentId: SYNC,
plankaCommentSendStartedAt: SYNC, plankaSentCommentId: SYNC, plankaCommentSentBaseline: SYNC,
todoistSendStartedAt: SYNC,
jiraCommentSendStartedAt: SYNC, jiraCommentDeliveryId: SYNC,
jiraSentCommentId: SYNC, jiraCommentSentBaseline: SYNC,
+3
View File
@@ -400,6 +400,9 @@ class ScopedImporter {
if (this._externalSource) {
const canMap = id => (id === this._userId || board.hasAdmin(this._userId)) && board.isActiveMember(id);
toCreate.members = (card.members || []).filter(canMap);
if (this._externalSource === 'openproject') {
toCreate.assignees = (card.assignees || []).filter(canMap);
}
toCreate.watchers = (card.watchers || []).filter(canMap);
}
toCreate.requesters = (card.requesters || []).filter(userId => boardMemberIds.has(userId));
+5 -1
View File
@@ -793,6 +793,9 @@ export class WekanCreator {
}
// WIP limit, flow policy, split, role restrictions (models/lib/wekanRecordFields.js).
Object.assign(listToCreate, wekanRecordFields('lists', list, this._recordMaps()));
const { remapListEntryRequirements } = require('./lib/listEntryRequirements');
const requirements = remapListEntryRequirements(list.entryRequirements, this.customFields);
if (requirements.length) listToCreate.entryRequirements = requirements;
const listId = await writeImportedEntity(Lists, listToCreate, {
ids: this.lists,
sourceId: list._id,
@@ -1204,11 +1207,12 @@ export class WekanCreator {
{ method: 'parseActivities' },
{ method: 'createBoardAndLabels', createsBoard: true },
{ method: 'applyFeatureProfileTemplate' },
// Entry requirements refer to custom fields by their new IDs.
{ method: 'createCustomFields', source: 'customFields' },
{ method: 'createLists', source: 'lists' },
{ method: 'createSwimlanes', source: 'swimlanes' },
// Board Settings name lists, so they come once the lists exist.
{ method: 'createBoardSettings' },
{ method: 'createCustomFields', source: 'customFields' },
{ method: 'createCards', source: 'cards' },
{ method: 'createSubtasks', source: 'cards' },
{ method: 'createCardDependencies', source: 'cards' },
+319
View File
@@ -23,6 +23,325 @@ Releases per day:
| 14 | 1 |
| 15 | 1 |
| 16 | 1 |
| 18 | 1 |
| 19 | 1 |
# v13.16 2026-11-19 WeKan ® release
**In short:** **ListLockBulkBleed** is fixed, and a list that refuses a role
now also refuses that role's bulk writes, dependency lines, rule actions and
changes to the list or swimlane itself. Administrators can give chosen users,
teams and organizations a smaller WeKan with opt-in **feature profiles**. A
server no longer runs out of memory in the hourly **History integrity audit**,
**scheduled rules** can create cards again, and **Card Excel export** and
clearing a card's text work again.
This release fixes the following CRITICAL SECURITY ISSUE of [ListLockBulkBleed](https://wekan.fi/hall-of-fame/listlockbulkbleed/):
<details>
<summary><a href="https://github.com/wekan/wekan/commit/ba3d94390ba724344a2d5cfe50e9dee3cc6f8d89">Bulk REST card writes and server-side card writes ask the list's role exception</a>. Thanks to immanuwell and xet7.</summary>
[GHSA-83w9-74mx-7v83](https://github.com/wekan/wekan/security/advisories/GHSA-83w9-74mx-7v83),
CWE-863. A board admin can refuse a role write access in one list (#4527).
`DELETE /api/boards/:boardId/cards/bulk` and
`POST /api/boards/:boardId/cards/labels` take their cards from the body, so no
URL names a list, and asked only for board write access; the methods
`archiveSelectedCards`, `copyCard` and `createLinkedCard` write from server
code, past the Cards allow/deny rules. A normal member the list refused could
permanently delete its cards in one request, relabel and archive them, and copy
or link new cards into it.
The bulk routes now read every card and ask each list before the first write:
any refusal is a 403 and nothing changes, and each removal and relabel is keyed
on the list that was checked. The refusal shows in Admin Panel / Problems as
ListLockBulkBleed (`authz.list-locked-bulk`, medium, never disables). The
methods answer `not-authorized` and are not recorded, because Copy Card and
Multi-Selection reach them in ordinary use. The same shape was fixed in twelve
more paths: converting a card to a board, adding a subtask,
`createCardWithDueDate`, the iCalendar import, sending and receiving board
email, creating a version-control issue, moving board objects, History and
position-history undo and redo, renaming an attachment, the scoped import and a
card's rule button. Dependency lines keep their own board-wide rule.
`tests/listLockBulkBleed.test.cjs` runs the gate on the reporter's board and
pins every path; `tests/playwright/specs/list-lock-bulk.e2e.js` replays the
proof of concept.
</details>
and adds the following new feature:
<details>
<summary><a href="https://github.com/wekan/wekan/commit/fc21b0b177dc8f8902efa39d0f89c8b041c7cf2d">Feature profiles hide features from the users, teams and organizations an administrator chooses</a>. Thanks to mimZD and xet7.</summary>
[#6837](https://github.com/wekan/wekan/issues/6837): Admin Panel / Settings /
Visibility / Features gains feature profiles - a name, the optional features it
hides, and the users, teams and organizations it applies to. It is strictly
opt-in: a user with no profile sees everything, a profile only hides and changes
no data or permission, and the member menu tells the user which profile hides
how many features, so nothing looks missing. Every place that hides a disabled
feature follows it. The new strings are in every language.
`tests/featureProfiles.test.cjs` and `feature-profiles.e2e.js` cover it.
</details>
and fixes the following bugs:
**Per-list role exceptions** - what else a list that refuses a role refuses,
as decided after ListLockBulkBleed.
<details>
<summary><a href="https://github.com/wekan/wekan/commit/da6d9d39b8bd209006fc02fe735f1c277a2be693">Dependency lines follow the card's list</a>. Thanks to xet7.</summary>
A dependency line is stored on its source card, but it followed only the
board-wide dependency rule, so a role a list refused could still add, change and
remove lines on that list's cards. Now the methods answer `not-authorized`, the
REST dependency routes answer 403 recorded as ListLockBleed, and the import
skips such lines; board and site admins are not restricted.
`tests/listLockDependencies.test.cjs` and `tests/listPermissions.test.cjs` pin
it, and `list-lock-bulk.e2e.js` replays it over REST.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/3202a1d7ac1027b41af5a5dfbe03893ccbc89c36">Deleting, archiving or moving a list or swimlane follows the list</a>. Thanks to xet7.</summary>
These do the same to the cards in them, yet were gated by board write access
alone. A list that refuses a role now also refuses that role deleting,
restoring, archiving or moving it, and deleting, archiving or moving a swimlane
holding its cards - on DDP, REST (403, recorded as ListLockBleed) and client
writes alike. The list menu no longer offers its archive actions there.
Renaming and reordering stay allowed, and board admins are never restricted.
`tests/listLockStructure.test.cjs` pins it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/ee24453dcb5d9ed8af5c07b848cbd5bd8979ae28">A rule action into a refusing list is skipped, and the rest of the rule runs</a>. Thanks to xet7.</summary>
A rule's move, archive, create-card, copy, link and list actions checked only
board write access. Each now asks the lists it writes in as the user who
triggered the rule; a refusing list skips that action and shows in Admin Panel /
Problems as ListLockRule (detected, low), since a rule meeting a locked list is
not an attack. `tests/listLockRules.test.cjs` pins it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/a0f36819610e6d0aa9c170340f8421c1b7fc2bbe">List Sync's rule replay skips such an action too</a>. Thanks to xet7.</summary>
The journaled List Sync replay still wrote with board write access only. Each of
its list-writing runners now decides before saving its command, records a
durable skip and lets the rest of the plan run; a replay reads the saved skip,
so it never re-decides and never skips a half-finished action.
`tests/listSyncRuleListSkip.test.cjs` pins it.
</details>
**Server memory and timed jobs** - what runs on its own, every hour.
<details>
<summary><a href="https://github.com/wekan/wekan/commit/cfd9a62466a64b58d514d46c3c6560f003704523">Swap alone is not high RAM usage, and resource monitors are not named like vulnerabilities</a>. Thanks to xet7.</summary>
A laptop with many programs open showed "RamBleed, high: high RAM usage started
(>= 90%)" at RAM 52% and swap 60%: swap at 25% started a period by itself. Swap
now counts only while RAM is also tight, the row says what started it, and only
RAM near full is high severity. The RAM, CPU, disk and speed rows are named for
what happened (HighRamUsage, HighCpuUsage, HighDiskUsage, SlowRequest) without a
CWE, and old rows are renamed at startup. `tests/ramHighTracker.test.cjs` and
`tests/resourceStreamNames.test.cjs` cover it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/7459c5bde66ea22966526a7179eede62b5233f0e">The History integrity audit streams each board instead of loading it whole</a>. Thanks to xet7.</summary>
A production server died twice with "JavaScript heap out of memory", 42 and 74
seconds after the hourly History integrity audit started, both times in its
first run after a restart. The audit fetched each board's whole History - every
row with its full previous and new content - into memory. It now streams each
board through a cursor and keeps only hashes and small summaries; the findings
are the same, in the same order. `tests/historyIntegrityStreaming.test.cjs`
compares both on forked, tampered and orphaned chains and fails if a board is
fetched whole.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/f23695cc1bf6447fb38693ea8fe2e1ce4ab51f8f">Scheduled rules act as the board's admin, so a created card has an author</a>. Thanks to xet7.</summary>
Every run of a scheduled rule with a "create card" action failed with "User ID
is required in cards insertAsync". Scheduled rules, auto-archive and attachment
retention acted as `board.createdBy`, but boards have no such field, so they ran
as nobody. They now act as the board's first active admin
(`models/lib/boardActor.js`), and the rule's new card names its author.
`tests/boardActor.test.cjs` scans the tree so nothing reads `board.createdBy`
again.
</details>
**Cards** - exporting a card, and clearing its text.
<details>
<summary><a href="https://github.com/wekan/wekan/commit/997c6d88ad4c67850831aa99de1f874765c90a41">Card Excel export works with only Description or only Labels selected</a>. Thanks to AhmedLukman and xet7.</summary>
The card Excel exporter loads the board, list and swimlane only when the
selected fields need them, and passes `null` for the rest. The shared card
document builder defaulted them with `board = {}`, which applies only to
`undefined`, so it read `.title` of `null` and the download ended in "Export
failed". The titles are optional now (`board?.title || ''`), which also covers
a PDF card export of a card with no swimlane.
`tests/cardExportDocument.test.cjs`
fails on the old code with that TypeError, and
`tests/playwright/specs/card-excel-field-selection.e2e.js` downloads both
workbooks from the real route and checks that each holds only its own field.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/c59c751547aa36fabda088eed4cfd7b8ce6b37e4">REST card update can clear a card title</a>. Thanks to AhmedLukman and xet7.</summary>
`PUT` with `{"title":""}` answered 404 and kept the old title, because the
handler read the title by truthiness. An empty title is a value now, a title
that is not a string is a 400 before anything is written, and
[an update that matches no card](https://github.com/wekan/wekan/commit/79a98822cbe6f1aaa0da0ad2646c7b2cb4fb2726)
is a 404 again. `tests/restCardSort.test.cjs` and
`tests/playwright/specs/rest-card-title.e2e.js` cover it.
</details>
<details>
<summary><a href="https://github.com/wekan/wekan/commit/aacb2fd4d68c4873bd01685dceee172c24e48379">A cleared card title or description can be undone and redone</a>. Thanks to AhmedLukman and xet7.</summary>
Clearing a value is an edit kept in History, not a deletion, so it is
restorable whatever Admin Panel / Problems / Delete says. Undo already put the
old text back, but redo and Restore of the clearing threw: collection2 removes
`''` from `$set` and then refuses the empty modifier. History, the card details,
the board description and the REST card update now write `''` as it is, and a
REST title of only spaces no longer fails with a 500.
`tests/emptyStringClearWrites.test.cjs` and
`tests/playwright/specs/card-clear-undo-redo.e2e.js` cover it.
</details>
and has the following developer-facing changes:
**Card Excel export** - the browser test for the fix above.
- [A Playwright spec drives the card Excel export with one field selected](https://github.com/wekan/wekan/commit/320a3ca8672b6a70867baa0c3f657d3a5eb53536).
Thanks to AhmedLukman and xet7.
**Node test suites** - a sandbox that resolves its helpers.
- [The attachment cleanup test resolves the Playwright helpers' own requires](https://github.com/wekan/wekan/commit/74dd0b705e21ecb4723dcb8a6055c7edc5aae9aa).
Thanks to xet7.
**WeLite REST API** - the upstream REST specs, run against the native WeLite
target as well.
- [Ownership selection](https://github.com/wekan/wekan/commit/049b628a0310a33026de423a590a6c33489d5b41). Thanks to xet7.
- [Card title edits](https://github.com/wekan/wekan/commit/22dae19a64325695a17dd90ea7f4675ffeecfbed). Thanks to xet7.
- [Board card sorting](https://github.com/wekan/wekan/commit/5f06b28aef680d2682e7fa4e965a0e797b502214). Thanks to xet7.
- [Archive and restore](https://github.com/wekan/wekan/commit/11fc468ff77f9126b97d1eca72de9c2d90314022). Thanks to xet7.
- [Subtasks](https://github.com/wekan/wekan/commit/db3f489ab27f672c9d1ab4db5feaf3a116eba928). Thanks to xet7.
- [Overtime](https://github.com/wekan/wekan/commit/2033c177ce452f59bc6cb9d3d07a6566169ed015). Thanks to xet7.
- [People features](https://github.com/wekan/wekan/commit/72ee1c8b231896586086ac7067ea6dd96135506c). Thanks to xet7.
- [User update](https://github.com/wekan/wekan/commit/e4115e68905f4b9a2d521a749a9fe77dde322aa9). Thanks to xet7.
- [Checklists](https://github.com/wekan/wekan/commit/ede46c7a9873f20864a77eeda7cb5007762824ff). Thanks to xet7.
- [Write-route scope](https://github.com/wekan/wekan/commit/399a8defec10165e1cf7fa18faa5113d5bb7176f). Thanks to xet7.
- [Assignment removal](https://github.com/wekan/wekan/commit/8abb9504bb1f714873419f7b481650d758294ef7). Thanks to xet7.
- [Dropdown item rename](https://github.com/wekan/wekan/commit/b8fd94a7e70bf65e85b8d06b491e4d3d13e3a9ec). Thanks to xet7.
- [Dropdown item deletion](https://github.com/wekan/wekan/commit/f1adc7982eca4aebf8831403f6b4bd219cec51b9). Thanks to xet7.
- [Custom-field lifecycle](https://github.com/wekan/wekan/commit/6bf2d53d756e59f494ea50587f62bc467afb7b77). Thanks to xet7.
- [Webhook settings](https://github.com/wekan/wekan/commit/f34fee658206ab4d90583f58746067793f10d12a). Thanks to xet7.
- [Native Playwright credentials are seeded before an API token is used](https://github.com/wekan/wekan/commit/a9059b7b155aaea4bf9ccb1647a492bab251bb10).
Thanks to xet7.
**WeLite attachments** - the attachment workflows in the native browser.
- [The upstream card attachment cascade spec](https://github.com/wekan/wekan/commit/26e27f62c4b6b9e2bcd1e10623de7dd3e0b31b5e). Thanks to xet7.
- [Attachment rename, and a missing form token is refused](https://github.com/wekan/wekan/commit/7c3b798a1d0ff6e26b6afa8f49c3359a73ba526a). Thanks to xet7.
- [Direct attachment removal in Chromium](https://github.com/wekan/wekan/commit/c060c6d2db51b2fc22fab72dadecd90ab173bd8f). Thanks to xet7.
- [The Version Control Attachments workflow](https://github.com/wekan/wekan/commit/b6bc2b200ce7545ca43b2f6b3a3ac39874227812). Thanks to xet7.
- [The Finnish attachment preview](https://github.com/wekan/wekan/commit/c5344761d856cf5234e5a12ccc61f336c6a9a0e8). Thanks to xet7.
- [The cascade spec reuses its browser session](https://github.com/wekan/wekan/commit/bd6b00c5f437237a3cab8bf7d51172d948e45462). Thanks to xet7.
- [The attachment browser workflow gets the time it needs](https://github.com/wekan/wekan/commit/333928f123f9dd061042c8b18b0e44663dc76d04). Thanks to xet7.
**WeLite boards and sessions** - export links and session revocation.
- [Both export links on the board](https://github.com/wekan/wekan/commit/075e6dbe730291543c8a384ce58429167976741c). Thanks to xet7.
- [Revoking one browser session](https://github.com/wekan/wekan/commit/e30c439fa7f4e82bb2f4f949513aa1fcc4287953). Thanks to xet7.
**WeLite right-to-left captions** - Arabic table captions read in their own
direction.
- [People table captions](https://github.com/wekan/wekan/commit/f1fe22ac16254fa3d7f14df6c09dd3f250c7d61a). Thanks to xet7.
- [Regional Arabic People table captions](https://github.com/wekan/wekan/commit/8c1152f23468e76d07c964b5f1358900372c8248). Thanks to xet7.
- [Arabic webhook field captions](https://github.com/wekan/wekan/commit/6f7292cffdfb42a7accf4955735bbd8a43d4472a). Thanks to xet7.
- [Regional Arabic attachment captions](https://github.com/wekan/wekan/commit/ba9504d6db8dbd2adf8e72b98cb10c991a379cda). Thanks to xet7.
Thanks to above GitHub users for their contributions and translators for their translations.
# v13.15 2026-11-18 WeKan ® release
**In short:** **RaceBleed** is fixed: deleting a card while somebody moves it
to another board no longer destroys its checklists, comments and attachments
while the card itself survives there, and a member deleting a card that was
just moved keeps their account. REST handlers now answer **404, not 500**, for
a swimlane, user or board that is not there.
This release fixes the following CRITICAL SECURITY ISSUE of [RaceBleed](https://wekan.fi/hall-of-fame/racebleed/):
<details>
<summary><a href="https://github.com/wekan/wekan/commit/c7a496c9cfd8f30e5bda16515eedeaa2ec80dc65">A card's children are destroyed only for a card whose own removal happened</a>. Thanks to xingmuse and xet7.</summary>
[GHSA-3vjg-3p4q-8fwh](https://github.com/wekan/wekan/security/advisories/GHSA-3vjg-3p4q-8fwh),
CWE-367. The REST card delete looked the card up on the board the caller was
authorised for, destroyed its checklists, checklist items, comments,
attachments and subcards by card id, and removed the card itself last, keyed
on that board and list. A move to another board landing in between left the
card alive on a board the deleter cannot read, stripped of every child, with
both requests answering 200. Every hooked removal had the same shape:
collection-hooks runs `Cards.before.remove`, where the cascade was, and then
removes by the caller's original selector - a swimlane, a delete batch, a
parent - which a moved card no longer matches. The custom-field link clean-up
did the same to the cards linked to it.
The card document is now the claim (`models/lib/claimedCardRemoval.js`): the
single and bulk REST deletes remove the card first and destroy its children
only when that removal matched, and the hooked removals cascade from
`Cards.after.remove`, only for a card that is really gone. A list deletion
removes a card only while it is still in that list, and the REST board move
that loses to a delete is a 404 instead of a 500.
A delete that lost the race, or arrived after the card was moved away from
the named board, is refused and shows in Admin Panel / Problems as RaceBleed
(`authz.card-delete-race`, medium). It never disables the account: a stale
view is not an attack, and PurgeBleed's critical record used to disable a
member who deleted a card somebody had just moved.
`tests/claimedCardRemoval.test.cjs` replays the reported race and scans
`server/` for any cascade before or without the card's removal;
`tests/playwright/specs/race-bleed.e2e.js` races twelve moves against
deletes and checks that a surviving card always keeps its checklist.
</details>
and fixes the following bug:
<details>
<summary><a href="https://github.com/wekan/wekan/commit/baaeea27e3dc6083b5d6a39d5b44a4e6d26ca088">REST API: a handler's not-found error is a 404, not a 500</a>. Thanks to xet7.</summary>
`httpStatusForError` knew only `NotFound`, while about two hundred throw sites
spell it Meteor's way - `not-found`, `board-not-found`, `user-not-found` and
the rest. So deleting a missing swimlane, or adding a board member nobody is
called, answered 500 "Internal server error" on a real server, though the
unit test, which stubs the helper, saw the 404. Any name that is or ends in
`not-found` is now a 404 with its message; anything unknown is still a 500
carrying no detail. `tests/restNotFoundStatus.test.cjs` runs the real helper
and fails on a spelling it would not map.
</details>
Thanks to above GitHub users for their contributions and translators for their translations.
# v13.14 2026-11-16 WeKan ® release
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "wekan",
"version": "v13.39.0",
"version": "v13.40.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wekan",
"version": "v13.39.0",
"version": "v13.40.0",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wekan",
"version": "v13.39.0",
"version": "v13.40.0",
"description": "Open-Source kanban",
"private": true,
"repository": {
+1 -1
View File
@@ -61,7 +61,7 @@ export function getSecureDOMPurifyConfig(urlSchemes = []) {
ALLOWED_TAGS: ['a', 'p', 'br', 'strong', 'em', 'u', 'cite', 's', 'del', 'strike', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'img', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'hr', 'div', 'span', 'time', 'details', 'summary', 'input', ...MATHML_TAGS],
// Allow safe attributes including href for anchor tags, plus MathML presentation attributes.
// 'type', 'checked', 'disabled' are for the task-list checkbox above (#2419).
ALLOWED_ATTR: ['href', 'title', 'alt', 'src', 'width', 'height', 'target', 'rel', 'datetime', 'data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block', 'type', 'checked', 'disabled', ...MATHML_ATTR],
ALLOWED_ATTR: ['href', 'title', 'alt', 'src', 'width', 'height', 'target', 'rel', 'datetime', 'data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block', 'data-jira-panel', 'type', 'checked', 'disabled', ...MATHML_ATTR],
// Allow safe protocols for links
// Plus any custom schemes the administrator listed (#3218).
ALLOWED_URI_REGEXP: allowedUriRegExp(urlSchemes),
+3 -3
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="utf8" />
<title>WeKan REST API v13.39</title>
<title>WeKan REST API v13.40</title>
<!-- needed for adaptive design -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@@ -498,11 +498,11 @@ data-styled.g662[id="sc-hFhjrW"]{content:"gelAUe,"}/*!sc*/
<body>
<div id="redoc"><div class="sc-dPmKWx eXwHqO redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-hHttOM iMkNMJ menu-content"><div class="sc-jokKPH fejYuX"><div data-testid="search-trigger" class="sc-cRcubC kWLWEm"><div class="sc-gzhUzI ejGLvh"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-bUAICN hRyRtS"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-gpABuY dGxToZ"><ul data-component-name="Menu/Menu" class="sc-llaQDn gIDdEs"><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-iMaYoB kYPxgQ"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="WeKan REST API" class="sc-cKRyZE edpvXG">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB dpiTia"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Production Security Concerns" class="sc-cKRyZE cXpWdQ">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Login" class="sc-cKRyZE cXpWdQ">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="AttachmentStorageSettings" class="sc-cKRyZE cXpWdQ">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-Line truncated
<div id="redoc"><div class="sc-dPmKWx eXwHqO redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-hHttOM iMkNMJ menu-content"><div class="sc-jokKPH fejYuX"><div data-testid="search-trigger" class="sc-cRcubC kWLWEm"><div class="sc-gzhUzI ejGLvh"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-bUAICN hRyRtS"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-gpABuY dGxToZ"><ul data-component-name="Menu/Menu" class="sc-llaQDn gIDdEs"><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-iMaYoB kYPxgQ"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="WeKan REST API" class="sc-cKRyZE edpvXG">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB dpiTia"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Production Security Concerns" class="sc-cKRyZE cXpWdQ">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Login" class="sc-cKRyZE cXpWdQ">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="AttachmentStorageSettings" class="sc-cKRyZE cXpWdQ">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-Line truncated
<script type="module">
import { hydrate } from "https://cdn.redocly.com/redoc/v3.2.0/bundles/redoc.standalone.js";
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.39","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.40","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
const __redoc_options = {"skipBundle":true,"disableTelemetry":false};
hydrate(__redoc_definition, __redoc_options, document.getElementById('redoc'));
+3 -1
View File
@@ -1,7 +1,7 @@
swagger: '2.0'
info:
title: WeKan REST API
version: v13.39
version: v13.40
description: |
The REST API allows you to control and extend WeKan with ease.
@@ -7673,6 +7673,8 @@ definitions:
type: string
startDate:
type: string
startDateMapping:
type: string
dueDate:
type: string
dueComplete:
+5 -1
View File
@@ -142,6 +142,8 @@ def prepare(repo, output, release, database_image=''):
if hook.count(pull_block) != 1:
raise ValueError('Expected one preinst image-pull block before downtime')
fallback = Path(__file__).with_name('ucs-pull-image.sh').read_text(encoding='utf-8')
helper_check = 'docker run --rm --entrypoint /usr/local/bin/node "$image" /opt/ucs-migration/start.mjs --check'
hook = hook.replace(pull_block + '\n' + helper_check, pull_block)
hook = hook.replace(pull_block, fallback + '\n' + """
ucs_compose="${BASH_SOURCE[0]%.preinst}.compose"
if [ ! -f "$ucs_compose" ]; then ucs_compose="$(dirname -- "${BASH_SOURCE[0]}")/compose"; fi
@@ -154,7 +156,9 @@ docker run --rm --entrypoint /usr/local/bin/node "$image" /opt/ucs-migration/sta
worker_tail = '-v /var/run/docker.sock:/var/run/docker.sock -v "$target:/data" "$helper"'
if hook.count(worker_tail) != 1:
raise ValueError('Expected one UCS migration worker command')
hook = hook.replace(worker_tail, worker_tail + ' /usr/local/bin/node /opt/ucs-migration/start.mjs')
worker_command = worker_tail + ' /usr/local/bin/node /opt/ucs-migration/start.mjs'
if worker_command not in hook:
hook = hook.replace(worker_tail, worker_command)
hook = distroless_ownership(hook)
(destination / 'preinst').write_text(hook, encoding='utf-8')
return {'app_image': app_image, 'helper_image': helper_image, 'database_image': database_image}
+2 -2
View File
@@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
appTitle = (defaultText = "Wekan"),
# The name of the app as it is displayed to the user.
appVersion = 1339,
appVersion = 1340,
# Increment this for every release.
appMarketingVersion = (defaultText = "13.39~2026-12-02"),
appMarketingVersion = (defaultText = "13.40~2026-12-02"),
# Human-readable presentation of the app version.
minUpgradableAppVersion = 0,
+28 -7
View File
@@ -15,7 +15,7 @@ import { ReactiveCache } from '/imports/reactiveCache';
import { Exporter } from '/models/exporter';
import { externalExportScope } from '/models/lib/exportFields';
import { anonymizeExportIdentities, assertExportEnabled } from '/models/lib/importExportSecurity';
import { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues } from '/models/lib/openProjectApiExport';
import { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues, openProjectExportLabelValues } from '/models/lib/openProjectApiExport';
import { createJiraIssues } from '/models/lib/jiraApiExport';
import { secureTransfer } from '/server/lib/secureTransfer';
import * as planka from '/models/lib/apiImport/planka';
@@ -127,8 +127,8 @@ Meteor.methods({
if (!complete) saved = await writeNotionBulkCheckpoint(checkpointId, checkpoint);
},
});
if (stalled || (!complete && saved)) {
result.push({ id, ok: false, error: 'history-request-retry' });
if (!complete) {
result.push({ id, ok: false, error: stalled || saved ? 'history-request-retry' : 'import-too-large' });
continue;
}
} else {
@@ -190,20 +190,41 @@ Meteor.methods({
const includeSubtasks = !fields?.length || fields.includes('subtasks');
const includeDependencies = !fields?.length || fields.includes('dependencies');
const workMappings = fields?.includes('custom-fields')
? openProjectExportWorkFields(await ReactiveCache.getCustomFields({ boardIds: boardId, type: 'number' })) : new Map();
? openProjectExportWorkFields(await ReactiveCache.getCustomFields({ boardIds: boardId, type: { $in: ['number', 'text', 'checkbox'] } })) : new Map();
const includePeople = fields?.includes('people');
const includeLabels = fields?.includes('labels');
const board = includeLabels ? await ReactiveCache.getBoard(boardId) : null;
const labelsById = new Map((board?.labels || []).map(({ _id, name }) => [_id, name]));
const selector = await exporter._scopedCardSelector(boardId);
const cards = await ReactiveCache.getCards(selector, {
fields: { _id: 1, title: 1, ...(includeDescription ? { description: 1 } : {}),
...(includeDates ? { startAt: 1, dueAt: 1 } : {}), ...(includeSubtasks ? { parentId: 1, parentIds: 1 } : {}),
...(includeDependencies ? { cardDependencies: 1 } : {}), ...(workMappings.size ? { customFields: 1 } : {}) },
...(includeDependencies ? { cardDependencies: 1 } : {}), ...(workMappings.size ? { customFields: 1 } : {}),
...(includeLabels ? { labelIds: 1 } : {}), ...(includePeople ? { assignees: 1 } : {}) },
sort: { sort: 1, _id: 1 },
});
const records = cards.map(card => ({
cardId: card._id, title: card.title, description: card.description, startAt: card.startAt, dueAt: card.dueAt,
parentId: card.parentId, parentIds: card.parentIds, cardDependencies: card.cardDependencies,
...(workMappings.size ? { workFields: openProjectExportWorkValues(card, workMappings) } : {}),
...(workMappings.size || includeLabels ? { workFields: {
...openProjectExportWorkValues(card, workMappings),
...openProjectExportLabelValues(card.labelIds?.map(id => labelsById.get(id))),
} } : {}),
}));
await anonymizeExportIdentities({ boardId, cards: records, language: user.profile?.language });
const anonymized = await anonymizeExportIdentities({ boardId, cards: records, language: user.profile?.language });
if (includePeople && !anonymized) {
// OpenProject supports one assignee. Preserve an unambiguous assignment
// and leave multi-person cards unassigned.
const assignments = cards.map(card => [...new Set(card.assignees || [])]);
const ids = [...new Set(assignments.filter(ids => ids.length === 1).map(([id]) => id))];
const users = ids.length ? await ReactiveCache.getUsers({ _id: { $in: ids } }, {
fields: { username: 1, 'profile.fullname': 1 },
}) : [];
const names = new Map(users.map(user => [user._id, user.profile?.fullname || user.username]));
assignments.forEach((ids, index) => {
if (ids.length) records[index].assigneeName = ids.length === 1 ? names.get(ids[0]) || '' : '';
});
}
const safeRecords = secureTransfer(records, { direction: 'export', source: 'export:openproject-api' });
try {
return await createOpenProjectWorkPackages(clean, projectId, safeRecords, apiImportRequest);
+5 -3
View File
@@ -14,13 +14,15 @@ export function sanitizeInput(input, { allowJiraTextColor = false, allowJiraBack
allowedTags: [],
allowedAttributes: {},
}) : sanitizeHtml(input, {
allowedTags: ['span', ...(allowJiraCloudNodes ? ['time', 'details', 'summary'] : [])],
allowedAttributes: { span: ['style', ...(allowJiraCloudNodes ? ['data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block'] : [])], ...(allowJiraCloudNodes ? { time: ['datetime'], details: ['data-jira-expand'] } : {}) },
allowedTags: ['span', 'u', 'sub', 'sup', ...(allowJiraCloudNodes ? ['time', 'details', 'summary', 'div'] : ['cite'])],
allowedAttributes: { span: ['style', ...(allowJiraCloudNodes ? ['data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block'] : [])], ...(allowJiraCloudNodes ? { time: ['datetime'], details: ['data-jira-expand'], div: ['data-jira-panel'] } : {}) },
allowedStyles: { span: {
color: [/^(?:#[a-f0-9]{6}|red|green|blue|black|white|yellow|gray|grey|orange|purple)$/i],
...(allowJiraBackgroundColor ? { 'background-color': [/^#[a-f0-9]{6}$/i] } : {}),
} },
exclusiveFilter: frame => frame.tag === 'span' && !frame.attribs.style && !frame.attribs['data-jira-status'] && !frame.attribs['data-jira-mention'] && !frame.attribs['data-jira-emoji'] && !frame.attribs['data-jira-cell-block'] ? 'excludeTag' : false,
exclusiveFilter: frame => frame.tag === 'div' && !/^(?:info|note|warning|success|error)$/.test(frame.attribs['data-jira-panel'])
? 'excludeTag'
: frame.tag === 'span' && !frame.attribs.style && !frame.attribs['data-jira-status'] && !frame.attribs['data-jira-mention'] && !frame.attribs['data-jira-emoji'] && !frame.attribs['data-jira-cell-block'] ? 'excludeTag' : false,
});
// Additional check for CSS injection patterns
+2 -1
View File
@@ -24,7 +24,7 @@ function describeSyncConflict(conflict, card, task, list, sourceKey, cards = [])
const local = card[field], incoming = task[field];
const fingerprint = createHash('sha256').update(JSON.stringify([
list._id, list.boardId, list.syncRevision, sourceKey, conflict.cardId,
conflict.externalId, field, local, incoming, card.syncLastSource,
conflict.externalId, field, local, incoming, card.syncLastSource, task.startDateMapping,
card.archived, Object.hasOwn(card, field),
])).digest('hex');
return { ...conflict, local: local ?? '', incoming: incoming ?? '', fingerprint };
@@ -44,6 +44,7 @@ function planSyncConflictResolution(conflicts, cards, tasks, list, sourceKey, re
return { card, changes: {
syncLastSource: { ...(card.syncLastSource || {}), [resolution.field]: task[resolution.field],
...(timeMappings[resolution.field] ? { [`${resolution.field}Mapping`]: timeMappings[resolution.field].identity } : {}),
...(resolution.field === 'startDate' && task.startDateMapping ? { startDateMapping: task.startDateMapping } : {}),
...(resolution.field === 'estimate' && estimateMapping ? { estimateMapping: estimateMapping.identity } : {}) },
...(resolution.choice === 'source' ? { [resolution.field]: task[resolution.field] } : {}),
} };
+80 -15
View File
@@ -21,7 +21,7 @@ import { validateAttachmentUrl } from '/models/lib/attachmentUrlValidation';
import { attachRepositoryComments, rateLimitWait } from '/models/lib/listSyncIssueDetails';
// The services' API clients, as the API import uses them (server/apiImport.js).
import { apiImportRequest } from '/server/lib/apiImportRequest';
import { openProjectSchemaPath, readOpenProjectHierarchyMetadata, readOpenProjectPlanning, readOpenProjectPlanningCatalog, readOpenProjectRelations, readOpenProjectTimeEntries, readOpenProjectWorkPackageDetails } from '/models/lib/apiImport/openproject';
import { openProjectBudgetLinks, openProjectSchemaPath, readOpenProjectHierarchyMetadata, readOpenProjectPlanning, readOpenProjectPlanningCatalog, readOpenProjectRelations, readOpenProjectTimeEntries, readOpenProjectWorkPackageDetails } from '/models/lib/apiImport/openproject';
import { openProjectVersionLinks, openProjectTitleKey, openProjectPlanningAssignmentId } from '/models/lib/openProjectVersions';
import { OPENPROJECT_TIME_FIELDS, isoDurationHours, sameOpenProjectDuration } from '/models/lib/openProjectDurations';
import { readJiraSyncComments, readJiraCloudIssueHistories, completeJiraDataCenterHistories, readJiraProjectSprints } from '/models/lib/apiImport/jira';
@@ -212,6 +212,16 @@ async function fetchJiraSprintField(base, headers) {
// the planning reader (models/lib/jiraScrumPlanning.js jiraPlanningFields) reads.
const sprintSchema = id => ({ [id]: { type: 'array', items: 'json', custom: JIRA_SPRINT_SCHEMA } });
async function fetchJiraStartDateField(get, version) {
const fields = await get(`/rest/api/${version}/field`);
if (!Array.isArray(fields)) throw new Error('Invalid Jira field list');
const ids = new Set(fields.filter(field => typeof field?.name === 'string' &&
field.name.trim().toLowerCase() === 'start date' && field.schema?.type === 'date' &&
/^customfield_[1-9]\d{0,15}$/.test(field.id || '')).map(field => field.id));
if (ids.size !== 1) throw new Error('Jira requires one visible date field named Start date.');
return ids.values().next().value;
}
async function fetchJiraCloudIssues(base, jql, headers, estimateFieldId, planning = {}) {
const issues = [], tokens = new Set();
const url = new URL(`${base}/rest/api/3/search/jql`);
@@ -225,6 +235,7 @@ async function fetchJiraCloudIssues(base, jql, headers, estimateFieldId, plannin
fields.push(estimateFieldId);
}
if (planning.sprintField) fields.push(planning.sprintField);
if (planning.startDateField) fields.push(planning.startDateField);
if (planning.labels) fields.push('priority', 'components', 'versions');
if (planning.releases || planning.labels) fields.push('fixVersions');
if (planning.dependencies) fields.push('issuelinks');
@@ -282,6 +293,7 @@ export async function fetchJiraIssues(syncSource, credential) {
const history = fields.includes('jiraHistory');
const apiVersion = cloud ? 3 : 2;
const get = async path => (await fetchJson(base + path, headers)).body;
const startDateField = fields.includes('startDate') ? await fetchJiraStartDateField(get, apiVersion) : undefined;
const complete = async result => {
if (labels && result.issues.some(issue => !Array.isArray(issue?.fields?.labels) ||
issue.fields.labels.some(label => typeof label !== 'string' || !label.trim()))) {
@@ -305,12 +317,13 @@ export async function fetchJiraIssues(syncSource, credential) {
}
return {
...withHistory,
...(startDateField ? { jiraStartDateFieldId: startDateField } : {}),
...(projectVersions ? { jiraProjectVersions: projectVersions } : {}),
...(fields.includes('sprint') && catalogEligible ? await readJiraProjectSprints(get, syncSource.projectKey) : {}),
...(voterIdentities ? { jiraVoterSnapshots: await readJiraSyncVoters(get, apiVersion, syncSource.projectKey, result.issues) } : {}),
};
};
const planning = { labels, releases: fields.includes('releases'), dependencies: fields.includes('dependencies'), comments, voterIdentities, history,
const planning = { startDateField, labels, releases: fields.includes('releases'), dependencies: fields.includes('dependencies'), comments, voterIdentities, history,
subtasks: fields.includes('subtasks'), votes: fields.includes('jiraVotes'),
sprintField: fields.includes('sprint') ? await fetchJiraSprintField(base, headers) : null };
if (cloud) {
@@ -318,7 +331,7 @@ export async function fetchJiraIssues(syncSource, credential) {
}
const estimateFieldId = syncSource.estimateFieldId;
if (estimateFieldId !== undefined && !/^customfield_\d{1,20}$/.test(estimateFieldId)) throw new Error('Invalid Jira estimate field');
const extraFields = [...(estimateFieldId ? [estimateFieldId] : []), ...(planning.dependencies ? ['issuelinks'] : []), ...(planning.subtasks ? ['parent'] : []), ...(comments || voterIdentities || history ? ['security'] : []), ...(labels ? ['labels', 'priority', 'components', 'fixVersions', 'versions'] : []), ...(planning.votes ? ['votes'] : [])];
const extraFields = [...(startDateField ? [startDateField] : []), ...(estimateFieldId ? [estimateFieldId] : []), ...(planning.dependencies ? ['issuelinks'] : []), ...(planning.subtasks ? ['parent'] : []), ...(comments || voterIdentities || history ? ['security'] : []), ...(labels ? ['labels', 'priority', 'components', 'fixVersions', 'versions'] : []), ...(planning.votes ? ['votes'] : [])];
const selectedFields = extraFields.length ? `&fields=*navigable,${extraFields.join(',')}` : '';
const issues = []; let total;
for (let page = 0; page < MAX_SYNC_PAGES; page += 1) {
@@ -449,7 +462,7 @@ export function isJiraCloud(url) {
return new URL(url).hostname.endsWith('.atlassian.net');
}
export async function updateJiraIssue(source, credential, issue, fields, assertCurrent, timetracking) {
export async function updateJiraIssue(source, credential, issue, fields, assertCurrent, timetracking, startDateField) {
if (inGrain()) throw new Error('Writing back to Jira is not available in Sandstorm.');
if (!/^[1-9]\d{0,19}$/.test(String(issue.id))) throw new Error('Invalid Jira issue ID.');
const base = String(source.url || '').replace(/\/+$/, '');
@@ -457,11 +470,27 @@ export async function updateJiraIssue(source, credential, issue, fields, assertC
const url = `${base}/rest/api/${version}/issue/${issue.id}`;
const auth = { Authorization: jiraAuthorization(base, credential) };
const { isDeepStrictEqual } = require('node:util');
let skippedStartDate = false;
if (startDateField) {
const { body: metadata } = await fetchJson(`${url}/editmeta`, { ...auth, Accept: 'application/json' })
.catch(error => {
if ([403, 404].includes(error.status)) return {};
throw error;
});
const date = metadata?.fields?.[startDateField];
if (date?.schema?.type !== 'date' || (!Array.isArray(date.operations) || !date.operations.includes('set')) ||
(fields[startDateField] === null && date.required !== false)) {
fields = { ...fields };
delete fields[startDateField];
skippedStartDate = true;
}
}
if (!Object.keys(fields).length && !timetracking) return { updated: false, skippedStartDate };
const selected = Object.keys(fields);
const requested = timetracking ? [...selected, 'timetracking'] : selected;
const { body: current } = await fetchJson(`${url}?fields=${requested.join(',')}`, { ...auth, Accept: 'application/json' });
if (String(current?.id) !== String(issue.id) || current.key !== issue.key ||
selected.some(field => !Object.hasOwn(current.fields || {}, field) || !isDeepStrictEqual(current.fields[field], issue.fields[field]))) return false;
selected.some(field => !Object.hasOwn(current.fields || {}, field) || !isDeepStrictEqual(current.fields[field], issue.fields[field]))) return { updated: false, skippedStartDate };
if (timetracking) {
const previous = issue.fields?.timetracking;
const latest = current.fields?.timetracking;
@@ -469,14 +498,14 @@ export async function updateJiraIssue(source, credential, issue, fields, assertC
const seconds = field + 'Seconds';
return !Object.hasOwn(previous || {}, seconds) || !Object.hasOwn(latest || {}, seconds) || latest[seconds] !== previous[seconds];
});
if (changed) return false;
if (changed) return { updated: false, skippedStartDate };
}
if (!await assertCurrent()) return false;
if (!await assertCurrent()) return { updated: false, skippedStartDate };
await writeSyncJson(url, 'PUT', auth, {
...(Object.keys(fields).length ? { fields } : {}),
...(timetracking ? { update: { timetracking: [{ edit: timetracking }] } } : {}),
}, true);
return true;
return { updated: true, skippedStartDate };
}
export async function updateJiraIssuePriority(source, credential, issue, name, assertCurrent) {
@@ -766,23 +795,43 @@ export async function updateOpenProjectWorkPackage(source, credential, workPacka
payload.storyPoints = points;
}
const warnings = [];
if (dueField === 'date' && fields.startDate) {
warnings.push('OpenProject milestones do not have a start date.');
}
const linkFields = [
['budget', /^\/api\/v3\/budgets\/[1-9]\d*$/],
['status', /^\/api\/v3\/statuses\/[1-9]\d*$/],
['type', /^\/api\/v3\/types\/[1-9]\d*$/],
['priority', /^\/api\/v3\/priorities\/[1-9]\d*$/],
].filter(([field]) => Object.hasOwn(fields, field));
if (linkFields.length) {
if (source.statusId || source.filterId || linkFields.some(([field]) => typeof fields[field] !== 'string' || !fields[field].trim())) {
throw new Error('OpenProject status and priority write-back require a named value on an unfiltered list.');
if (source.statusId || source.filterId || linkFields.some(([field]) =>
!(field === 'budget' && fields.budget === null) && (typeof fields[field] !== 'string' || !fields[field].trim()))) {
throw new Error('OpenProject link fields require an allowed value on an unfiltered list.');
}
const form = await writeSyncJson(`${base}/api/v3/work_packages/${id}/form`, 'POST', auth, { lockVersion });
if (stillCurrent && !await stillCurrent()) return;
for (const [field, path] of linkFields) {
const property = form?._embedded?.schema?.[field];
const links = property?._links?.allowedValues;
let links = property?._links?.allowedValues;
if (field === 'budget' && property?.writable === true) {
if (fields.budget === null) {
(payload._links ||= {}).budget = { href: null };
continue;
}
const project = workPackage._links?.project?.href;
const projectId = typeof project === 'string' && /^\/api\/v3\/(?:projects|workspaces)\/([1-9]\d*)$/.exec(project)?.[1];
const budgetsPath = projectId ? `/api/v3/projects/${projectId}/budgets` : undefined;
if (budgetsPath && links?.href === budgetsPath) {
links = await fetchJson(base + budgetsPath, { ...auth, Accept: 'application/hal+json' })
.then(({ body }) => openProjectBudgetLinks(body)).catch(() => undefined);
if (stillCurrent && !await stillCurrent()) return;
}
}
const embedded = property?._embedded?.allowedValues;
const candidates = [
...(Array.isArray(links) ? links : []),
...(Array.isArray(embedded) ? embedded.map(value => ({ title: value?.name, href: value?._links?.self?.href })) : []),
...(Array.isArray(embedded) ? embedded.map(value => ({ title: field === 'budget' ? value?.subject : value?.name, href: value?._links?.self?.href })) : []),
];
const matches = new Set(candidates.filter(link => link?.title === fields[field] &&
typeof link.href === 'string' && path.test(link.href)).map(link => link.href));
@@ -791,7 +840,7 @@ export async function updateOpenProjectWorkPackage(source, credential, workPacka
} else {
warnings.push(field === 'status'
? 'OpenProject does not report a unique allowed transition to this status.'
: 'OpenProject does not report this priority as a unique allowed value.');
: `OpenProject does not report this ${field} as a unique allowed value.`);
}
}
}
@@ -818,6 +867,22 @@ export async function updateOpenProjectWorkPackage(source, credential, workPacka
payload[remote] = seconds === null ? null : `PT${seconds}S`;
estimates.push([remote, value]);
}
const type = payload._links?.type;
if (type) {
// Changing type can change fields and workflow. Preview the full update,
// keeping milestone conversion separate from ordinary type write-back.
const form = await writeSyncJson(`${base}/api/v3/work_packages/${id}/form`, 'POST', auth, payload);
if (stillCurrent && !await stillCurrent()) return;
const { schema, payload: preview, validationErrors } = form?._embedded || {};
const compatibleDates = dueField === 'date' ? schema?.date?.type === 'Date'
: schema?.dueDate?.type === 'Date' && !schema.date;
if (form?._type !== 'Form' || !compatibleDates || preview?._links?.type?.href !== type.href ||
Object.keys(validationErrors || {}).length) {
delete payload._links.type;
if (!Object.keys(payload._links).length) delete payload._links;
warnings.push('OpenProject did not confirm a compatible work package type.');
}
}
const warning = warnings.join(' ') || undefined;
if (Object.keys(payload).length === 1) return warning;
const updated = await writeSyncJson(`${base}/api/v3/work_packages/${id}`, 'PATCH',
@@ -948,7 +1013,7 @@ export async function fetchOpenProjectWorkPackages(syncSource, credential) {
function apiSyncFetcher(type, client, request = () => apiImportRequest) {
// `client` and `request` are functions, read at the call: the module's
// imports are not there yet when the table below is built in a test.
return async (syncSource, credential, { notionBodyResume } = {}) => {
return async (syncSource, credential, { notionBodyResume, notionRollupResume } = {}) => {
if (inGrain()) throw new Error('Sync from this service is not available in Sandstorm.');
const { apiSyncCredentials, DEPENDENCY_SYNC_SOURCES, SUBTASK_SYNC_SOURCES } = require('/models/lib/apiSyncSources');
const { cleanApiImportCredentials } = require('/models/lib/apiImportServices');
@@ -957,7 +1022,7 @@ function apiSyncFetcher(type, client, request = () => apiImportRequest) {
const api = client();
const fields = DEPENDENCY_SYNC_SOURCES.includes(type) || SUBTASK_SYNC_SOURCES.includes(type) || ['todoistapi', 'notionapi', 'planka'].includes(type)
? [syncSource.fields] : [];
if (type === 'notionapi') fields.push(syncSource.notionBodyAfter, notionBodyResume);
if (type === 'notionapi') fields.push(syncSource.notionBodyAfter, notionBodyResume, notionRollupResume);
return await (api.fetchForSync || api.fetch)(sign, String(syncSource.projectKey || ''), request(), ...fields);
} catch (error) {
throw syncFetchError(error);
+4 -3
View File
@@ -18,7 +18,7 @@ const present = value => value !== undefined && value !== null && value !== '' &
// The planning attributes as Sync reads them once selected; otherwise what the
// one-time import does with them (a tag), as before.
function issueRules(type, issue, estimateMapping, timeMappings, selected = new Set(), sprintField = null, markdown = false) {
function issueRules(type, issue, estimateMapping, timeMappings, selected = new Set(), sprintField = null, markdown = false, jiraStartDateFieldId) {
const planning = (field, otherwise) => (selected.has(field) ? mapped(field, true) : otherwise);
if (type === 'openproject') {
// What parseOpenProject reads of a work package (models/lib/externalParsers.js).
@@ -84,6 +84,7 @@ function issueRules(type, issue, estimateMapping, timeMappings, selected = new S
comment: Array.isArray(issue.syncComments) ? unusedFallback : selected.has('comments') ? undefined : mapped('comments'),
...(selected.has('comments') ? { security: mapped('externalId') } : {}),
duedate: mapped('dueDate', true),
...(jiraStartDateFieldId ? { [jiraStartDateFieldId]: mapped('startDate', true) } : {}),
assignee: mapped('owner_username'), reporter: mapped('requested_by'),
timespent: fields.timetracking?.timeSpentSeconds == null ? mapped('spentTime', true) : unusedFallback,
...timeRules, timetracking: trackingRules,
@@ -188,7 +189,7 @@ function describeSyncSourceCoverage(type, raw, fields, estimateMapping = null, t
add(issuePath, 'excluded-item');
continue;
}
const rules = issueRules(type, issue, estimateMapping, timeMappings, selected, sprintField, markdown);
const rules = issueRules(type, issue, estimateMapping, timeMappings, selected, sprintField, markdown, raw.jiraStartDateFieldId);
if (workPackages) {
const plan = openProjectDetails?.planningByIssue?.get(String(issue.id));
for (const [key, field] of [
@@ -236,7 +237,7 @@ function describeSyncSourceCoverage(type, raw, fields, estimateMapping = null, t
maxResults: mapped('externalId'), total: mapped('externalId'), isLast: mapped('externalId'),
nextPageToken: mapped('externalId'), board: { name: mapped('board.name') },
// WeKan's own Jira export saying its text is Markdown (jiraWikiMarkup.js).
wekanTextFormat: mapped('externalId'),
wekanTextFormat: mapped('externalId'), jiraStartDateFieldId: mapped('externalId'),
// Which field is the Sprint (server/lib/listSyncFetch.js), not issue data.
...(sprintField ? { schema: mapped('externalId') } : {}) };
inspect(raw, envelope, '');
+21 -7
View File
@@ -648,7 +648,7 @@ export async function writeBackToOpenProject({ list, source, sourceKey, credenti
const writableTimeMappings = Object.fromEntries(Object.entries(timeMappings)
.filter(([field]) => ['originalEstimate', 'remainingEstimate', 'scheduleManually', 'ignoreNonWorkingDays', 'duration', 'progress'].includes(field)));
if (!source.statusId && !source.filterId) {
for (const field of ['status', 'priority']) {
for (const field of ['status', 'priority', 'type', 'budget']) {
if (timeMappings[field] && !timeMappings[field].openProjectReadOnly) writableTimeMappings[field] = timeMappings[field];
}
}
@@ -720,7 +720,7 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
.filter(([field, mapping]) => ['originalEstimate', 'remainingEstimate'].includes(field) && !mapping.jiraReadOnly));
const writableMappings = estimateMapping ? { ...writableTimes, estimate: estimateMapping } : writableTimes;
const fields = (source.fields || ['title', 'description']).filter(field =>
['title', 'description', 'dueDate'].includes(field) || Object.hasOwn(writableMappings, field));
['title', 'description', 'dueDate', 'startDate'].includes(field) || Object.hasOwn(writableMappings, field));
const sendComments = source.fields?.includes('comments');
const sendLabels = source.fields?.includes('labels') && source.jiraLabelWriteBackSince instanceof Date && jiraLabelSnapshots;
if (!fields.length && !sendComments && !sendLabels) return;
@@ -733,9 +733,12 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
const { addSyncTimeEstimates, cardSyncTimes } = require('/models/lib/listSyncTimeEstimates');
let tasks = addSyncTimeEstimates(addSyncEstimates(parseJira(raw).tasks, raw, estimateMapping), raw, writableTimes);
if (fields.includes('dueDate')) tasks = addIssueDueDates('jira', raw, tasks);
if (fields.includes('startDate')) {
tasks = addIssueDueDates('jira', raw, tasks, 'startDate');
}
const scope = { boardId: list.boardId, listId: list._id, syncSourceKey: sourceKey };
const cards = await Cards.find({ ...scope, syncExternalId: { $in: [...byKey.keys()] } }, {
transform: null, fields: { syncExternalId: 1, title: 1, description: 1, archived: 1, dueAt: 1, syncLastSource: 1, customFields: 1, ...(sendLabels ? { labelIds: 1, jiraLabelBaseline: 1 } : {}) },
transform: null, fields: { syncExternalId: 1, title: 1, description: 1, archived: 1, dueAt: 1, startAt: 1, syncLastSource: 1, customFields: 1, ...(sendLabels ? { labelIds: 1, jiraLabelBaseline: 1 } : {}) },
}).fetchAsync();
if (sendLabels) {
const { planJiraLabelWriteBack, planJiraPriorityWriteBack, planJiraOptionWriteBack } = require('/models/lib/jiraLabelWriteBack');
@@ -763,8 +766,10 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
}
}
const datedCards = cards.map(card => ({ ...card, ...cardSyncTimes(card, writableTimes), estimate: cardSyncEstimate(card, estimateMapping),
startDate: card.startAt?.toISOString().slice(0, 10) || '',
dueDate: card.dueAt?.toISOString().slice(0, 10) || '' }));
let invalidTimeEstimates = 0;
let skippedStartDates = 0;
for (const { card, body } of planTaskTextWriteBack({ tasks, cards: datedCards, fields, timeMappings: writableMappings })) {
const issue = byKey.get(card.syncExternalId);
const prefix = `[${issue.key}] `;
@@ -784,6 +789,9 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
canonicalDescription = jiraTextToMarkdown(remoteFields.description, adfPlainText);
assertEquivalentDescription(body.description, canonicalDescription);
}
const startDateField = body.startDate !== undefined && raw.jiraStartDateFieldId &&
card.syncLastSource?.startDateMapping === raw.jiraStartDateFieldId ? raw.jiraStartDateFieldId : undefined;
if (startDateField) remoteFields[startDateField] = body.startDate || null;
if (body.dueDate !== undefined) remoteFields.duedate = body.dueDate || null;
if (body.estimate !== undefined) remoteFields[estimateMapping.estimateFieldId] = body.estimate;
const edit = {};
@@ -799,12 +807,13 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
const timetracking = Object.keys(edit).length ? edit : undefined;
if (!Object.keys(remoteFields).length && !timetracking) continue;
const selector = { ...scope, _id: card._id, ...exactFieldSelector(card,
['syncExternalId', 'title', 'description', 'archived', 'dueAt', 'syncLastSource', ...(Object.keys(writableMappings).length ? ['customFields'] : [])]) };
['syncExternalId', 'title', 'description', 'archived', 'dueAt', 'startAt', 'syncLastSource', ...(Object.keys(writableMappings).length ? ['customFields'] : [])]) };
await assertCurrent();
const updated = await updateJiraIssue(source, credential, issue, remoteFields, async () => {
const { updated, skippedStartDate } = await updateJiraIssue(source, credential, issue, remoteFields, async () => {
await assertCurrent();
return !!await fieldReadContext.exit(() => Cards.findOneAsync(selector, { fields: { _id: 1 } }));
}, timetracking);
}, timetracking, startDateField);
if (skippedStartDate) skippedStartDates += 1;
if (!updated) continue;
const changes = {};
if (remoteFields.summary && card.title !== prefix + remoteFields.summary) changes.title = prefix + remoteFields.summary;
@@ -859,9 +868,14 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
send: (issue, body, claim) => addJiraServiceRequestComment(source, credential, issue, body, claim),
});
}
const warnings = [];
if (invalidTimeEstimates) {
throw new Error(`Jira skipped ${invalidTimeEstimates} time estimate edit(s). Enter a duration in whole minutes, including zero.`);
warnings.push(`Jira skipped ${invalidTimeEstimates} time estimate edit(s). Enter a duration in whole minutes, including zero.`);
}
if (skippedStartDates) {
warnings.push(`Jira did not allow ${skippedStartDates} Start date edit(s).`);
}
if (warnings.length) throw new Error(warnings.join(' '));
}
async function writeJiraCommentEdits({ scope, cards, targets, assertCurrent, prepareBody, send, serviceRequest = false }) {
+26 -2
View File
@@ -17,7 +17,10 @@ Meteor.startup(async () => {
const lifetime = 60 * 60 * 1000;
const compress = promisify(gzip);
const decompress = promisify(gunzip);
const maxBulkBytes = 64 * 1024 * 1024;
// Bound both the stored snapshot and its expansion. Most Markdown compresses
// much smaller than its decoded size.
const maxBulkBytes = 256 * 1024 * 1024;
const maxEncodedBytes = 64 * 1024 * 1024;
const chunkSize = 8 * 1024 * 1024;
export async function readNotionBodyCheckpoint(list, credential) {
@@ -35,6 +38,26 @@ export async function writeNotionBodyCheckpoint(list, credential, checkpoint) {
await NotionBodyCheckpoints.upsertAsync(identity, { $set: { checkpoint, expiresAt: new Date(Date.now() + lifetime) } });
}
function rollupCheckpointIdentity(list, credential) {
return { _id: `rollup:${credential._id}`, listId: list._id, boardId: list.boardId };
}
export async function readNotionRollupCheckpoint(list, credential) {
return (await NotionBodyCheckpoints.findOneAsync({
...rollupCheckpointIdentity(list, credential), expiresAt: { $gt: new Date() },
}))?.checkpoint;
}
export async function writeNotionRollupCheckpoint(list, credential, checkpoint) {
const identity = rollupCheckpointIdentity(list, credential);
if (!checkpoint) {
await NotionBodyCheckpoints.removeAsync(identity);
return;
}
await NotionBodyCheckpoints.upsertAsync(identity,
{ $set: { checkpoint, expiresAt: new Date(checkpoint.startedAt + lifetime) } });
}
export function notionBulkCheckpointId(userId, sourceId, fields, token) {
return `bulk:${createHash('sha256').update(JSON.stringify([userId, sourceId, fields, token])).digest('hex')}`;
}
@@ -48,7 +71,7 @@ export async function readNotionBulkCheckpoint(id) {
if (pieces.length !== saved.parts || pieces.some((piece, index) => piece.part !== index)) return undefined;
contents = pieces.map(piece => piece.contents).join('');
}
if (!contents) return undefined;
if (!contents || contents.length > maxEncodedBytes) return undefined;
return JSON.parse((await decompress(Buffer.from(contents, 'base64'), { maxOutputLength: maxBulkBytes })).toString());
}
@@ -60,6 +83,7 @@ export async function writeNotionBulkCheckpoint(id, progress) {
const bytes = Buffer.from(JSON.stringify(progress));
if (bytes.length > maxBulkBytes) return false;
const contents = (await compress(bytes)).toString('base64');
if (contents.length > maxEncodedBytes) return false;
const expiresAt = new Date(Date.now() + lifetime);
const previous = await NotionBodyCheckpoints.findOneAsync(id, { fields: { generation: 1 } });
if (contents.length <= chunkSize) {
+20 -1
View File
@@ -1,5 +1,9 @@
import { sanitizeTransferValue } from '/models/lib/importExportBoundary';
import { MAX_NOTION_IMPORT_MARKDOWN_BYTES } from '/models/lib/notionApiFormat';
import { sanitizeInput } from '/server/lib/inputSanitizer';
import { randomUUID } from 'node:crypto';
const jiraPanelLine = /^<!-- (?:jira-panel:[a-z0-9%_.!~*'()-]{0,6144}|\/jira-panel) -->$/gmi;
// Server wrapper around the pure structural boundary. This is deliberately the
// only place that couples transfer validation to server HTML sanitization and Admin Problems,
@@ -11,16 +15,31 @@ export function secureTransfer(value, context = {}) {
sanitizeHtml: (input, path) => {
const jiraDescription = context.direction === 'export' && context.source === 'export:jira-api' &&
/^\/\d+\/description$/.test(path);
return sanitizeInput(input, {
// sanitize-html removes comments, including the Data Center panel
// boundaries. Protect only these standalone marker lines, while the
// panel body still passes through the usual sanitizer.
const panelMarkers = new Map();
const text = jiraDescription && context.jiraCloud !== true
? input.replace(jiraPanelLine, marker => {
const placeholder = `JIRAPANEL${randomUUID()}`;
panelMarkers.set(placeholder, marker);
return placeholder;
})
: input;
const clean = sanitizeInput(text, {
allowJiraTextColor: jiraDescription,
allowJiraBackgroundColor: jiraDescription && context.jiraCloud === true,
allowJiraCloudNodes: jiraDescription && context.jiraCloud === true,
});
return panelMarkers.size ? clean.replace(/^JIRAPANEL[0-9a-f-]{36}$/gm,
marker => panelMarkers.get(marker) || marker) : clean;
},
maxDepth: context.maxDepth,
maxNodes: context.maxNodes,
maxArray: context.maxArray,
maxString: context.maxString,
maxStringForPath: path => context.direction === 'import' && context.source === 'import:notionapi' &&
/^\/pages\/\d+\/body$/.test(path) ? MAX_NOTION_IMPORT_MARKDOWN_BYTES : undefined,
maxBinaryString: context.maxBinaryString,
});
if (result.warnings.length) {
@@ -4,6 +4,7 @@ import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import {
NotionBodyCheckpoints, notionBulkCheckpointId, readNotionBulkCheckpoint, writeNotionBulkCheckpoint,
readNotionRollupCheckpoint, writeNotionRollupCheckpoint,
} from '/server/lib/notionBodyCheckpoints';
describe('Notion bulk checkpoint storage', function () {
@@ -40,6 +41,40 @@ describe('Notion bulk checkpoint storage', function () {
}
});
it('resumes compressed Markdown snapshots larger than 64 MiB', async function () {
if (!Meteor.isAppTest) this.skip();
this.timeout(15000);
const id = notionBulkCheckpointId(Random.id(), Random.id(), ['description'], Random.secret());
const body = 'Markdown paragraph. '.repeat(210000);
const progress = { cursor: 'next-page', document: {
pages: Array.from({ length: 17 }, (_, index) => ({ id: String(index), body })),
} };
try {
assert.ok(body.length * progress.document.pages.length > 64 * 1024 * 1024);
assert.equal(await writeNotionBulkCheckpoint(id, progress), true);
assert.deepEqual(await readNotionBulkCheckpoint(id), progress);
} finally {
await writeNotionBulkCheckpoint(id, null);
}
});
it('isolates rollup progress by list and credential and respects its deadline', async function () {
if (!Meteor.isAppTest) this.skip();
const list = { _id: Random.id(), boardId: Random.id() };
const credential = { _id: Random.id() };
const progress = { sourceId: Random.id(), startedAt: Date.now(), targets: [[Random.id(), Random.id()]] };
try {
await writeNotionRollupCheckpoint(list, credential, progress);
assert.deepEqual(await readNotionRollupCheckpoint(list, credential), progress);
assert.equal(await readNotionRollupCheckpoint({ ...list, _id: Random.id() }, credential), undefined);
assert.equal(await readNotionRollupCheckpoint(list, { _id: Random.id() }), undefined);
await writeNotionRollupCheckpoint(list, credential, { ...progress, startedAt: progress.startedAt - 3600001 });
assert.equal(await readNotionRollupCheckpoint(list, credential), undefined);
} finally {
await writeNotionRollupCheckpoint(list, credential, null);
}
});
it('splits a large page snapshot across MongoDB documents', async function () {
if (!Meteor.isAppTest) this.skip();
this.timeout(15000);
+12 -6
View File
@@ -34,7 +34,7 @@ const { MAPPED_FIELDS, syncTimeFieldSelector, syncTimeMappings, timeMappingIdent
import ListSyncCredentials from '/models/listSyncCredentials';
import { EXTERNAL_PARSERS, openProjectTimeEntriesByPackage, SYNC_CAPABLE_SOURCES } from '/models/lib/externalParsers';
import { planListSyncReconcile, validateListSyncTasks } from '/models/lib/listSyncReconcile';
import { readNotionBodyCheckpoint, writeNotionBodyCheckpoint } from '/server/lib/notionBodyCheckpoints';
import { readNotionBodyCheckpoint, writeNotionBodyCheckpoint, readNotionRollupCheckpoint, writeNotionRollupCheckpoint } from '/server/lib/notionBodyCheckpoints';
import { validateImportSourceShape } from '/models/lib/importSourceShape';
import { LIST_SYNC_FETCHERS, recordSyncUrlBlocked, isJiraCloud } from '/server/lib/listSyncFetch';
import { SyncedCron } from '/server/cron/syncedCron';
@@ -206,16 +206,22 @@ async function reconcileList(list, { fetchers = LIST_SYNC_FETCHERS, resolution,
$set: { syncWriteBackError: String((writeError && writeError.message) || writeError).slice(0, 500) } });
}
}
const resumeNotionBody = source.type === 'notionapi' && source.fields?.includes('description') &&
!dryRun && !resolution && !conflictScope && recordCoverage;
const checkpointNotion = source.type === 'notionapi' && !dryRun && !resolution && !conflictScope && recordCoverage;
const resumeNotionBody = checkpointNotion && source.fields?.includes('description');
const resumeNotionRollup = checkpointNotion && source.fields?.includes('dependencies');
const notionBodyResume = resumeNotionBody ? await readNotionBodyCheckpoint(list, credential) : undefined;
const notionRollupResume = resumeNotionRollup ? await readNotionRollupCheckpoint(list, credential) : undefined;
const raw = await fetcher(estimateMapping ? { ...source, estimateFieldId: estimateMapping.estimateFieldId } : source,
credential, { notionBodyResume });
credential, { notionBodyResume, notionRollupResume });
validateImportSourceShape(source.type, raw);
if (resumeNotionBody && raw.bodyCheckpoint !== notionBodyResume) {
await assertCurrent();
await writeNotionBodyCheckpoint(list, credential, raw.bodyCheckpoint);
}
if (resumeNotionRollup && (raw.rollupCheckpoint || notionRollupResume)) {
await assertCurrent();
await writeNotionRollupCheckpoint(list, credential, raw.rollupCheckpoint);
}
if (source.type === 'notionapi') {
notionBodyAfter = raw.nextBodyAfter;
if (source.fields?.includes('notionPeople')) {
@@ -309,7 +315,7 @@ async function reconcileList(list, { fetchers = LIST_SYNC_FETCHERS, resolution,
const { addIssueDueDates } = require('/models/lib/listSyncIssueDueDates');
parsed.tasks = addIssueDueDates(source.type, raw, parsed.tasks);
}
if (['openproject', 'redmineapi'].includes(source.type) && source.fields?.includes('startDate')) {
if (['jira', 'openproject', 'redmineapi'].includes(source.type) && source.fields?.includes('startDate')) {
const { addIssueDueDates } = require('/models/lib/listSyncIssueDueDates');
parsed.tasks = addIssueDueDates(source.type, raw, parsed.tasks, 'startDate');
}
@@ -809,7 +815,7 @@ async function reconcileList(list, { fetchers = LIST_SYNC_FETCHERS, resolution,
...syncTimeBaseline(task, timeMappings),
...(task.dueDate !== undefined ? { dueDate: task.dueDate } : {}),
...(task.dueComplete !== undefined ? { dueComplete: task.dueComplete } : {}),
...(task.startDate !== undefined ? { startDate: task.startDate } : {}),
...(task.startDate !== undefined ? { startDate: task.startDate, ...(task.startDateMapping ? { startDateMapping: task.startDateMapping } : {}) } : {}),
...(task.reminderDate !== undefined ? { reminderDate: task.reminderDate } : {}),
...(task.title !== undefined ? { title: task.title } : {}),
...(task.description !== undefined ? { description: task.description } : {}),
+11
View File
@@ -138,6 +138,17 @@ const foreachRemovedMember = (doc, modifier, callback) => {
};
Meteor.methods({
async 'boards.addLabel'(boardId, name, color, dueAt) {
check(boardId, String);
check(name, String);
check(color, String);
check(dueAt, Match.Maybe(Date));
await Authentication.checkBoardAdmin(this.userId, boardId);
const board = await Boards.findOneAsync(boardId);
if (!board) throw new Meteor.Error('not-found');
return board.addLabel(name, color, dueAt);
},
// #6947: Board Settings / Date's due date colours, a board admin's. A
// threshold null goes back to the default; anything but 0 to a year of
// hours is refused.
+4 -4
View File
@@ -19,7 +19,7 @@
# base: core24 (not core26) · no build-base: devel · grade: stable
# ─────────────────────────────────────────────────────────────────────────────
name: wekan
version: '13.39'
version: '13.40'
base: core24
confinement: strict
grade: stable
@@ -703,18 +703,18 @@ parts:
armhf) WEKAN_ARCH="armhf" ;;
*) echo "Unsupported architecture: ${CRAFT_ARCH_BUILD_FOR}"; exit 1 ;;
esac
WEKAN_ZIP="wekan-13.39-${WEKAN_ARCH}.zip"
WEKAN_ZIP="wekan-13.40-${WEKAN_ARCH}.zip"
echo "Cleaning environment first"
rm -rf .build
mkdir .build
cd .build
#wget https://github.com/wekan/wekan/releases/download/v13.39/wekan-13.39-amd64.zip
#wget https://github.com/wekan/wekan/releases/download/v13.40/wekan-13.40-amd64.zip
# Retry: a release asset can 404 for a short while right after it is
# uploaded (CDN/propagation lag), and a plain wget treated that as
# fatal. --retry-on-http-error covers the 404/5xx window; a genuinely
# missing bundle still fails after the tries are spent.
wget --tries=20 --waitretry=20 --retry-on-http-error=404,403,500,502,503 \
"https://github.com/wekan/wekan/releases/download/v13.39/${WEKAN_ZIP}"
"https://github.com/wekan/wekan/releases/download/v13.40/${WEKAN_ZIP}"
unzip "${WEKAN_ZIP}"
python3 ../releases/check-telemetry.py --bundle bundle
rm "${WEKAN_ZIP}"
+1 -1
View File
@@ -122,7 +122,7 @@ test('the header bars are glass with dark text; blue is the primary action and t
`.${CLASS} input[type=submit].primary`,
`.${CLASS} .sidebar .sidebar-content .sidebar-btn`,
]) {
assert.ok(rule(selector).includes('#2563eb'), `${selector} uses #2563eb`);
assert.match(rule(selector), /#1e40af/, `${selector} uses the higher-contrast blue`);
}
});
+26 -2
View File
@@ -13,10 +13,10 @@ const sanitizeInput = new Function('require', sanitizerSource
.replace(/export /g, '') + '\nreturn sanitizeInput;')(require);
const sanitizeTransferValue = new Function(read('models/lib/importExportBoundary.js')
.replace(/export \{[^}]+\};/, '') + '\nreturn sanitizeTransferValue;')();
const secureTransfer = new Function('sanitizeTransferValue', 'sanitizeInput', 'require',
const secureTransfer = new Function('sanitizeTransferValue', 'sanitizeInput', 'randomUUID', 'require',
read('server/lib/secureTransfer.js').replace(/^import .*;$/gm, '')
.replace('export default secureTransfer;', '').replace(/export /g, '')
+ '\nreturn secureTransfer;')(sanitizeTransferValue, sanitizeInput,
+ '\nreturn secureTransfer;')(sanitizeTransferValue, sanitizeInput, require('node:crypto').randomUUID,
() => ({ record() {} }));
const source = read('models/exporter.js');
const method = source.slice(source.indexOf(' async buildStream(res) {'), source.indexOf(' async buildCsv('));
@@ -140,6 +140,30 @@ function response() {
}), [{ description: 'Warning' }]);
assert.equal(sanitizeInput('<span style="color:red;position:fixed">One</span><span style="position:fixed">Two</span>',
{ allowJiraTextColor: true }), '<span style="color:red">One</span>Two');
const inlineMarks = '<u class="discard">Underlined</u> H<sub>2</sub>O x<sup>2</sup> <cite>Handbook</cite>';
const cleanMarks = '<u>Underlined</u> H<sub>2</sub>O x<sup>2</sup> ';
for (const jiraCloud of [false, true]) {
assert.deepEqual(secureTransfer([{ description: inlineMarks, title: inlineMarks }], {
direction: 'export', source: 'export:jira-api', jiraCloud,
}), [{
description: cleanMarks + (jiraCloud ? 'Handbook' : '<cite>Handbook</cite>'),
title: 'Underlined H2O x2 Handbook',
}]);
}
const panel = '<!-- jira-panel:title%3DNotes -->\n\n<u>Safe</u>\n\n<!-- /jira-panel -->';
for (const jiraCloud of [false, true]) {
const [result] = secureTransfer([{ description: panel, title: panel }], {
direction: 'export', source: 'export:jira-api', jiraCloud,
});
assert.equal(result.description, jiraCloud ? '<u>Safe</u>' : panel);
assert.equal(result.title, 'Safe');
}
const cloudPanel = '<div data-jira-panel="info">\n\nText\n\n</div>';
const [exportedPanel] = secureTransfer([{
description: cloudPanel.replace('<div ', '<div class="discard" '), title: cloudPanel,
}], { direction: 'export', source: 'export:jira-api', jiraCloud: true });
assert.equal(exportedPanel.description, cloudPanel);
assert.equal(exportedPanel.title, 'Text');
const highlight = '<span style="background-color:#fedec8">Marked</span>';
assert.deepEqual(secureTransfer([{ description: highlight, title: highlight }], {
direction: 'export', source: 'export:jira-api', jiraCloud: true,
+8
View File
@@ -139,4 +139,12 @@ test('a text export is made from sanitized values, not sanitized as HTML afterwa
assert.doesNotMatch(build, /secureTransfer\(await collect\(/, 'negative: never the collected documents whole');
});
test('a path-specific string budget counts UTF-8 bytes and leaves other fields bounded', () => {
const options = { maxString: 3, maxStringForPath: path => path === '/pages/0/body' ? 8 : undefined };
assert.deepStrictEqual(boundary.sanitizeTransferValue({ pages: [{ body: 'éééé' }] }, options).value,
{ pages: [{ body: 'éééé' }] });
assert.throws(() => boundary.sanitizeTransferValue({ pages: [{ body: 'ééééé' }] }, options), /string limit exceeded/);
assert.throws(() => boundary.sanitizeTransferValue({ pages: [{ title: 'long' }] }, options), /string limit exceeded/);
});
console.log(`\nimportExportBoundary: ${passed} tests passed`);
+75
View File
@@ -353,3 +353,78 @@ test('exports explicitly tagged Jira components without treating ordinary labels
return { key: 'PROJ-9', id: '10003' };
});
});
test('preserves a three-level hierarchy with verified Jira Cloud issue types', async () => {
const { createJiraIssues } = await import('../models/lib/jiraApiExport.js');
const credentials = { url: 'https://example.atlassian.net', username: 'name@example.com', token: 'test-token' };
const types = [
{ id: '11', name: 'Epic', subtask: false, hierarchyLevel: 1 },
{ id: '12', name: 'Task', subtask: false, hierarchyLevel: 0 },
{ id: '13', name: 'Subtask', subtask: true, hierarchyLevel: -1 },
];
const cards = [
{ cardId: 'leaf', title: 'Leaf', parentId: 'middle' },
{ cardId: 'middle', title: 'Middle', parentId: 'root' },
{ cardId: 'root', title: 'Root' },
];
for (const writable of [true, false]) {
const issued = [];
const result = await createJiraIssues(credentials, 'PROJ', '12', cards, async (url, { method, body }) => {
const path = new URL(url).pathname;
if (path === '/rest/api/3/project/PROJ') return { key: 'PROJ', issueTypes: types };
if (path.endsWith('/issuetypes')) return { startAt: 0, total: types.length, issueTypes: types };
if (path.endsWith('/issuetypes/12')) return { startAt: 0, total: 1,
fields: [{ fieldId: 'parent', operations: writable ? ['set'] : [] }] };
assert.equal(method, 'POST');
issued.push([body.fields.summary, body.fields.issuetype.id, body.fields.parent?.key]);
return { key: `PROJ-${issued.length}` };
}, '13');
if (writable) {
assert.deepEqual(issued, [['Root', '11', undefined], ['Middle', '12', 'PROJ-1'], ['Leaf', '13', 'PROJ-2']]);
assert.equal(result.skippedParents, undefined);
} else {
assert.equal(result.skippedParents, 1);
assert.ok(issued.every(([, type]) => type !== '11'));
}
}
});
test('exports a four-level Jira hierarchy only with a unique, writable path', async () => {
const { createJiraIssues } = await import('../models/lib/jiraApiExport.js');
const credentials = { url: 'https://example.atlassian.net', username: 'name@example.com', token: 'test-token' };
const supported = [
{ id: '10', name: 'Initiative', subtask: false, hierarchyLevel: 2 },
{ id: '11', name: 'Epic', subtask: false, hierarchyLevel: 1 },
{ id: '12', name: 'Task', subtask: false, hierarchyLevel: 0 },
{ id: '13', name: 'Subtask', subtask: true, hierarchyLevel: -1 },
];
const cards = ['Leaf', 'Task', 'Epic', 'Initiative'].map((title, index, names) => ({
cardId: title, title, parentId: names[index + 1],
}));
for (const mode of ['supported', 'ambiguous', 'read-only']) {
const types = mode === 'ambiguous' ? [...supported, { ...supported[1], id: '14' }] : supported;
const issued = [];
const result = await createJiraIssues(credentials, 'PROJ', '12', cards, async (url, { method, body }) => {
const path = new URL(url).pathname;
if (path === '/rest/api/3/project/PROJ') return { key: 'PROJ', issueTypes: types };
if (path.endsWith('/issuetypes')) return { startAt: 0, total: types.length, issueTypes: types };
if (/\/issuetypes\/(11|12)$/.test(path)) {
const operations = mode === 'read-only' && path.endsWith('/11') ? [] : ['set'];
return { startAt: 0, total: 1, fields: [{ fieldId: 'parent', operations }] };
}
assert.equal(method, 'POST');
issued.push([body.fields.summary, body.fields.issuetype.id, body.fields.parent?.key]);
return { key: `PROJ-${issued.length}` };
}, '13');
if (mode === 'supported') {
assert.deepEqual(issued, [
['Initiative', '10', undefined], ['Epic', '11', 'PROJ-1'],
['Task', '12', 'PROJ-2'], ['Leaf', '13', 'PROJ-3'],
]);
assert.equal(result.skippedParents, undefined);
} else {
assert.equal(result.skippedParents, 2);
assert.ok(issued.every(([, type]) => type === '12' || type === '13'));
}
}
});
+80 -2
View File
@@ -51,12 +51,13 @@ const load = rel => import(pathToFileURL(path.join(root, rel)).href);
assert.equal(md('line one\\\\line two'), 'line one \nline two');
assert.equal(md('above\n----\nbelow'), 'above\n---\nbelow');
assert.equal(md('{code:java}\nint x = 1 * 2 * 3;\n# not a list\n{code}'), '```java\nint x = 1 * 2 * 3;\n# not a list\n```');
assert.equal(md('{code:title=Main.java|borderStyle=solid}\nmain();\n{code}'), '```\nmain();\n```');
assert.equal(md('{code:title=Main.java|borderStyle=solid}\nmain();\n{code}'), '```text jira-macro:title%3DMain.java%7CborderStyle%3Dsolid\nmain();\n```');
assert.equal(md('{noformat}\n*raw* h1. text\n{noformat}'), '```noformat\n*raw* h1. text\n```');
assert.equal(md('||Name||Value||\n|a|1|\n|b|*2*|'), '| Name | Value |\n| --- | --- |\n| a | 1 |\n| b | **2** |');
assert.equal(md('|C:\\temp\\|x|'), '| | |\n| --- | --- |\n| C:\\\\temp\\\\ | x |', 'a backslash in a cell cannot end it');
assert.equal(md('|no|header|'), '| | |\n| --- | --- |\n| no | header |');
assert.equal(md('{panel:title=Note}\nInside\n{panel}'), 'Inside');
assert.equal(md('{panel:title=Note}\nInside\n{panel}'),
'<!-- jira-panel:title%3DNote -->\n\nInside\n\n<!-- /jira-panel -->');
assert.equal(md('line\r\nnext'), 'line\nnext');
// Negative: what is not wiki markup is left as it is.
@@ -769,3 +770,80 @@ require('node:test').test('Jira Cloud table disclosures retain their title, form
assert.deepEqual(jiraCloudDescription(markdown, doc), doc);
assert.throws(() => jiraCloudDescription(markdown.replace('</details>', ''), doc), /formatting/);
});
require('node:test').test('editing a Jira Cloud disclosure preserves its media blocks', async () => {
const { jiraTextToMarkdown } = await import('../models/lib/jiraWikiMarkup.js');
const { adfPlainText } = await import('../models/lib/externalParsers.js');
const { jiraCloudDescription } = require('../models/lib/jiraDescriptionWriteBack');
const media = { type: 'mediaSingle', attrs: { layout: 'center' }, content: [
{ type: 'media', attrs: { id: 'existing-media-id', type: 'file', collection: 'jira' } },
] };
const mediaGroup = { type: 'mediaGroup', content: [
{ type: 'media', attrs: { id: 'existing-group-item', type: 'file', collection: 'jira' } },
] };
const doc = { type: 'doc', version: 1, content: [{ type: 'expand', attrs: { title: 'Checks' }, content: [
{ type: 'paragraph', content: [{ type: 'text', text: 'Before' }] }, media,
{ type: 'paragraph', content: [{ type: 'text', text: 'After' }] }, mediaGroup,
] }] };
const markdown = jiraTextToMarkdown(doc, adfPlainText);
assert.match(markdown, /\[Jira media 1\]/);
assert.deepEqual(jiraCloudDescription(markdown, doc), doc);
const updated = jiraCloudDescription(markdown.replace('Before', 'Reviewed'), doc);
assert.equal(updated.content[0].content[0].content[0].text, 'Reviewed');
assert.deepEqual(updated.content[0].content[1], media);
assert.deepEqual(updated.content[0].content[3], mediaGroup);
assert.throws(() => jiraCloudDescription(markdown.replace('[Jira media 1]', '[Jira media 2]'), doc), /formatting/);
assert.throws(() => jiraCloudDescription(markdown.replace(/`\[Jira media 1\]`/, ''), doc), /formatting/);
assert.throws(() => jiraCloudDescription(markdown, null), /formatting/);
});
require('node:test').test('editing a Jira Data Center quote preserves its code and noformat options', async () => {
const { jiraWikiToMarkdown } = await import('../models/lib/jiraWikiMarkup.js');
const { jiraDataCenterDescription } = require('../models/lib/jiraDescriptionWriteBack');
const source = '{quote}\nSteps\n\n{code:js|title=Run|borderStyle=solid|borderWidth=2px|borderColor=#ccc}\nmain();\n{code}\n\n' +
'{noformat:borderStyle=dashed|titleBGColor=#F7D6C1|bgColor=#FFFFCE}\nOutput\n{noformat}\n{quote}';
const markdown = jiraWikiToMarkdown(source);
assert.match(markdown, /js jira-macro:js%7Ctitle%3DRun%7CborderStyle%3Dsolid/);
assert.equal(jiraDataCenterDescription(markdown.replace('Steps', 'Steps verified'), source, jiraWikiToMarkdown),
source.replace('Steps', 'Steps verified'));
assert.throws(() => jiraDataCenterDescription(markdown.replace('%3Dsolid', '%3Ddashed'), source, jiraWikiToMarkdown), /formatting/);
assert.throws(() => jiraDataCenterDescription(markdown.replace('%23ccc', 'invalid'), source, jiraWikiToMarkdown), /formatting/);
assert.throws(() => jiraDataCenterDescription('New text', source, jiraWikiToMarkdown), /formatting/);
});
require('node:test').test('Jira Data Center preserves panel options and nested literal blocks when editing the body', async () => {
const { jiraWikiToMarkdown } = await import('../models/lib/jiraWikiMarkup.js');
const { jiraDataCenterDescription, assertEquivalentDescription } = require('../models/lib/jiraDescriptionWriteBack');
const previous = '{panel:title=Notes|borderStyle=solid}\nOriginal text\n\n' +
'{code:js|title=Example}\nconst ready = true;\n{code}\n\n' +
'{noformat:title=Output}\nReady\n{noformat}\n{panel}';
const imported = jiraWikiToMarkdown(previous);
const updated = imported.replace('Original text', '**Edited** text');
const written = jiraDataCenterDescription(updated, previous, jiraWikiToMarkdown);
assert.equal(written, previous.replace('Original text', '*Edited* text'));
assertEquivalentDescription(updated, jiraWikiToMarkdown(written));
assert.throws(() => jiraDataCenterDescription(updated.replace('Notes', 'Other'), previous, jiraWikiToMarkdown),
/does not support this formatting/);
assert.throws(() => jiraDataCenterDescription(updated.replace('<!-- /jira-panel -->', ''), previous, jiraWikiToMarkdown),
/does not support this formatting/);
});
require('node:test').test('Jira Cloud panels retain their type and editable Markdown blocks', async () => {
const { jiraTextToMarkdown } = await import('../models/lib/jiraWikiMarkup.js');
const { jiraCloudDescription, assertEquivalentDescription } = require('../models/lib/jiraDescriptionWriteBack');
const { adfPlainText } = await import('../models/lib/externalParsers.js');
const previous = { type: 'doc', version: 1, content: [{ type: 'panel', attrs: { panelType: 'warning' },
content: [{ type: 'heading', attrs: { level: 2 }, content: [{ type: 'text', text: 'Read this' }] },
{ type: 'paragraph', content: [{ type: 'text', text: 'Before editing', marks: [{ type: 'strong' }] }] }],
}] };
const imported = jiraTextToMarkdown(previous, adfPlainText);
assert.match(imported, /<div data-jira-panel="warning">/);
const updated = imported.replace('Before editing', 'After editing');
const exported = jiraCloudDescription(updated, previous);
assert.equal(exported.content[0].attrs.panelType, 'warning');
assert.equal(exported.content[0].content[1].content[0].text, 'After editing');
assert.deepEqual(exported.content[0].content[1].content[0].marks, [{ type: 'strong' }]);
assertEquivalentDescription(updated, jiraTextToMarkdown(exported, adfPlainText));
assert.throws(() => jiraCloudDescription(updated.replace('warning', 'custom'), previous), /does not support/);
assert.throws(() => jiraCloudDescription(updated.replace('</div>', ''), previous), /does not support/);
});
+6 -1
View File
@@ -2,7 +2,7 @@
const { test } = require('node:test');
const assert = require('node:assert/strict');
const { listEntryOptions, missingListEntryFields } = require('../models/lib/listEntryRequirements');
const { listEntryOptions, missingListEntryFields, remapListEntryRequirements } = require('../models/lib/listEntryRequirements');
test('list entry requires configured values and accepts false and zero', () => {
const fields = [{ _id: 'waiting', name: 'Waiting for' }, { _id: 'checked', name: 'Checked' }];
@@ -20,3 +20,8 @@ test('lists with no requirements and removed or protected definitions allow entr
assert.deepEqual(missingListEntryFields({}, {}, definitions), []);
assert.deepEqual(missingListEntryFields({ entryRequirements: ['custom:removed', 'custom:private'] }, {}, definitions), []);
});
test('native imports remap field references, retain dates, and discard missing or invalid values', () => {
assert.deepEqual(remapListEntryRequirements(
['dueAt', 'custom:old', 'custom:missing', 'dueAt', '__proto__', null], { old: 'new' }), ['dueAt', 'custom:new']);
});
+124 -3
View File
@@ -27,7 +27,7 @@ function harness(responses, extras = {}) {
calls.push({ url, options });
const response = responses.shift();
if (!response) throw new Error('Unexpected request');
return { ok: true, headers: new Headers(response.headers || {}), json: async () => response.body };
return { ok: (response.status || 200) < 400, status: response.status || 200, headers: new Headers(response.headers || {}), json: async () => response.body };
} };
vm.createContext(context);
vm.runInContext(fs.readFileSync(path.join(root, 'server/lib/listSyncFetch.js'), 'utf8')
@@ -265,6 +265,9 @@ test('selected OpenProject milestone dates distinguish null from missing and rej
assert.deepEqual(addIssueDueDates('openproject', { _embedded: { elements } }, tasks), [
{ externalId: '1', dueDate: '2028-02-29' }, { externalId: '2', dueDate: '' }, { externalId: '3' },
]);
assert.deepEqual(addIssueDueDates('openproject', { _embedded: { elements } }, tasks, 'startDate'), [
{ externalId: '1', startDate: '' }, { externalId: '2', startDate: '' }, { externalId: '3' },
]);
elements[0].date = '2028-02-30';
assert.throws(() => addIssueDueDates('openproject', { _embedded: { elements } }, tasks), /invalid due date/);
});
@@ -334,8 +337,9 @@ test('OpenProject write-back requires a version and sends the selected fields to
test('OpenProject milestone write-back clears its date through the milestone field', async () => {
const { context, calls } = harness([{ body: { id: 41, date: null } }]);
await context.updateOpenProjectWorkPackage(config, { token: 'fixture' }, { id: 41, lockVersion: 2, date: '2028-03-01' },
{ dueDate: '' });
const warning = await context.updateOpenProjectWorkPackage(config, { token: 'fixture' }, { id: 41, lockVersion: 2, date: '2028-03-01' },
{ dueDate: '', startDate: '2028-02-29' });
assert.match(warning, /milestones do not have a start date/);
assert.deepEqual(JSON.parse(calls[0].options.body), { lockVersion: 2, date: null });
});
@@ -469,3 +473,120 @@ test('OpenProject priority write-back ignores choices outside the priority resou
/priority as a unique allowed value/);
assert.equal(calls.length, 1);
});
test('OpenProject writes a work package type only after the versioned form confirms it', async () => {
const credential = { token: 'fixture' };
const workPackage = { id: 41, lockVersion: 7 };
const href = '/api/v3/types/6';
const type = { href };
const choices = { body: { _embedded: { schema: {
type: { writable: true, _links: { allowedValues: [{ href, title: 'Bug' }] } },
} } } };
const confirmed = schema => ({ body: { _type: 'Form', _embedded: {
schema, validationErrors: {}, payload: { _links: { type } },
} } });
const valid = harness([choices, confirmed({ dueDate: { type: 'Date' } }),
{ body: { id: 41, _links: { type } } }]);
assert.equal(await valid.context.updateOpenProjectWorkPackage(config, credential, workPackage, { type: 'Bug' }), undefined);
assert.deepEqual(valid.calls.map(call => [call.options.method, JSON.parse(call.options.body)]), [
['POST', { lockVersion: 7 }],
['POST', { lockVersion: 7, _links: { type } }],
['PATCH', { lockVersion: 7, _links: { type } }],
]);
const incompatible = harness([choices, confirmed({ date: { type: 'Date' } }),
{ body: { id: 41, subject: 'Independent edit' } }]);
assert.match(await incompatible.context.updateOpenProjectWorkPackage(config, credential, workPackage,
{ type: 'Bug', title: 'Independent edit' }), /compatible work package type/);
assert.deepEqual(JSON.parse(incompatible.calls[2].options.body), { lockVersion: 7, subject: 'Independent edit' });
const filtered = harness([]);
await assert.rejects(filtered.context.updateOpenProjectWorkPackage({ ...config, filterId: '4' },
credential, workPackage, { type: 'Bug' }), /unfiltered list/);
assert.equal(filtered.calls.length, 0);
});
test('OpenProject writes or clears a budget through the current project edit form', async () => {
const { openProjectBudgetLinks } = await import('../models/lib/apiImport/openproject.js');
const budgetPath = '/api/v3/projects/10/budgets';
const href = '/api/v3/budgets/12';
const workPackage = { id: 41, lockVersion: 7, _links: { project: { href: '/api/v3/workspaces/10' } } };
const form = (path, writable = true) => ({ body: { _embedded: { schema: {
budget: { writable, _links: { allowedValues: { href: path } } },
} } } });
const catalog = { body: { _type: 'Collection', total: 1, count: 1, _embedded: { elements: [
{ _type: 'Budget', subject: 'Operations', id: 12, _links: { self: { href } } },
] } } };
const confirmed = href => ({ body: { id: 41, _links: { budget: { href } } } });
const credential = { token: 'fixture' };
const valid = harness([form(budgetPath), catalog, confirmed(href)], { openProjectBudgetLinks });
assert.equal(await valid.context.updateOpenProjectWorkPackage(config, credential, workPackage, { budget: 'Operations' }), undefined);
assert.equal(new URL(valid.calls[1].url).pathname, budgetPath);
assert.deepEqual(JSON.parse(valid.calls[2].options.body), { lockVersion: 7, _links: { budget: { href } } });
const clear = harness([form(budgetPath), confirmed(null)]);
await clear.context.updateOpenProjectWorkPackage(config, credential, workPackage, { budget: null });
assert.deepEqual(JSON.parse(clear.calls[1].options.body), { lockVersion: 7, _links: { budget: { href: null } } });
const foreign = harness([form('/api/v3/projects/11/budgets')]);
assert.match(await foreign.context.updateOpenProjectWorkPackage(config, credential, workPackage, { budget: 'Operations' }),
/not report this budget/);
assert.equal(foreign.calls.length, 1);
});
test('Jira Sync discovers and reads one Start date field on Cloud and Data Center', async () => {
const { addIssueDueDates } = require('../models/lib/listSyncIssueDueDates');
const field = { id: 'customfield_105', name: 'Start date', schema: { type: 'date' } };
const issues = [
{ key: 'DEMO-1', fields: { [field.id]: '2028-02-29', duedate: '2028-03-01' } },
{ key: 'DEMO-2', fields: { [field.id]: null } },
{ key: 'DEMO-3', fields: {} },
];
for (const [url, version, result] of [
['https://demo.atlassian.net', 3, { issues, isLast: true }],
['https://jira.example.test', 2, { issues, startAt: 0, total: issues.length }],
]) {
const source = { url, projectKey: 'DEMO', fields: ['startDate'] };
const { context, calls } = harness([{ body: [field] }, { body: result }]);
const raw = await context.fetchJiraIssues(source, { token: 'fixture', username: 'test@example.test' });
assert.equal(new URL(calls[0].url).pathname, `/rest/api/${version}/field`);
assert.match(new URL(calls[1].url).searchParams.get('fields'), /customfield_105/);
const tasks = issues.map(issue => ({ externalId: issue.key }));
assert.deepEqual(addIssueDueDates('jira', raw, tasks, 'startDate'), [
{ externalId: 'DEMO-1', startDate: '2028-02-29', startDateMapping: field.id },
{ externalId: 'DEMO-2', startDate: '', startDateMapping: field.id }, tasks[2],
]);
const ambiguous = harness([{ body: [field, { ...field, id: 'customfield_106' }] }]);
await assert.rejects(ambiguous.context.fetchJiraIssues(source, { token: 'fixture', username: 'test@example.test' }),
/one visible date field/);
assert.equal(ambiguous.calls.length, 1);
}
assert.throws(() => addIssueDueDates('jira', { jiraStartDateFieldId: field.id,
issues: [{ key: 'DEMO-1', fields: { [field.id]: '2028-02-30' } }] }, [], 'startDate'), /invalid start date/);
});
test('Jira start date writes require edit metadata and an unchanged remote field', async () => {
const field = 'customfield_105';
const issue = { id: '10', key: 'DEMO-1', fields: { [field]: '2028-02-29' } };
const credential = { token: 'fixture' };
const source = { url: 'https://jira.example.test', projectKey: 'DEMO' };
const metadata = (operations, required = false) => ({ body: {
fields: { [field]: { schema: { type: 'date' }, operations, required } },
} });
const extras = { require };
for (const [responses, value, expected, skippedStartDate = false] of [
[[metadata(['set']), { body: issue }, { status: 204 }], '2028-03-04', true],
[[metadata(['set']), { body: { ...issue, fields: { [field]: '2028-03-02' } } }], '2028-03-04', false],
[[metadata([])], '2028-03-04', false, true],
[[metadata(['set'], true)], null, false, true],
]) {
const { context, calls } = harness(responses, extras);
const result = await context.updateJiraIssue(source, credential, issue, { [field]: value }, async () => true, undefined, field);
assert.deepEqual({ ...result }, { updated: expected, skippedStartDate });
assert.equal(calls.some(call => call.options.method === 'PUT'), expected);
}
const current = { ...issue, fields: { ...issue.fields, summary: 'Old' } };
const { context, calls } = harness([{ status: 404 }, { body: current }, { status: 204 }], extras);
const updated = await context.updateJiraIssue(source, credential, current, {
summary: 'New', [field]: '2028-03-04',
}, async () => true, undefined, field);
assert.deepEqual({ ...updated }, { updated: true, skippedStartDate: true });
assert.deepEqual(JSON.parse(calls[2].options.body), { fields: { summary: 'New' } });
});
+13
View File
@@ -79,3 +79,16 @@ test('OpenProject start dates preserve local edits and compare the stored date b
assert.equal(changed.conflicts[0].field, 'startDate');
assert.deepEqual(syncTextSelector(local, 'board', 'list').startAt, { $eq: local.startAt });
});
test('Jira start date baselines cannot be reused for a different date field', () => {
const local = {
...card, startDate: '2028-03-04',
syncLastSource: { ...card.syncLastSource, startDate: '2028-02-29', startDateMapping: 'customfield_105' },
};
const incoming = { ...task, startDate: '2028-02-29', startDateMapping: 'customfield_106' };
const changedField = planSyncTextMerge([incoming], [local]);
assert.deepEqual(changedField.conflicts, [{ cardId: 'c', externalId: '1', field: 'startDate' }]);
const aligned = planSyncTextMerge([{ ...incoming, startDate: local.startDate }], [local]);
assert.equal(aligned.conflicts.length, 0);
assert.equal(aligned.baselines.get('c').startDateMapping, 'customfield_106');
});
+31 -3
View File
@@ -525,12 +525,13 @@ test('Notion can assemble a page beyond the per-run download budget over two syn
const first = '00aa1234-1234-1234-1234-123456789ab3';
const second = '00aa1234-1234-1234-1234-123456789ab4';
const marker = value => `<unknown url="https://www.notion.so/${value}"/>`;
let secondSize = 2560 * 1024;
const request = async (target, { method }) => {
if (method === 'POST') return { results: [{ ...card, last_edited_time: '2026-12-01T10:00:00Z' }], has_more: false };
if (!target.includes('/markdown?')) return source;
const block = new URL(target).pathname.split('/')[3];
const markdown = block === card.id ? [marker(first), marker(second)].join('\n')
: 'x'.repeat(block === first ? 3 * 1024 * 1024 : 1536 * 1024);
: 'x'.repeat(block === first ? 3 * 1024 * 1024 : secondSize);
const unknown = block === card.id ? [first, second] : [];
return { object: 'page_markdown', id: block, markdown, truncated: unknown.length > 0, unknown_block_ids: unknown };
};
@@ -538,12 +539,13 @@ test('Notion can assemble a page beyond the per-run download budget over two syn
assert.ok(partial.bodyCheckpoint);
assert.equal(partial.pages[0].bodyOmitted, 'limit');
const complete = await fetchForSync(credentials, id, request, ['description'], partial.nextBodyAfter, partial.bodyCheckpoint);
assert.equal(complete.pages[0].body.length, 4608 * 1024 + 1);
assert.equal(complete.pages[0].body.length, 5632 * 1024 + 1);
assert.equal(complete.pages[0].bodyOmitted, undefined);
assert.equal(complete.bodyCheckpoint, undefined);
secondSize = 3 * 1024 * 1024;
const imported = await fetch(credentials, id, request, ['description'], { importBodyAfter: '' });
assert.equal(imported.pages[0].body.length, 4608 * 1024 + 1);
assert.equal(imported.pages[0].body.length, 6 * 1024 * 1024 + 1);
assert.equal(imported.pages[0].bodyOmitted, undefined);
assert.equal(imported.nextImportBodyAfter, null);
});
@@ -806,3 +808,29 @@ test('Notion batch fetch can resume a saved cursor and report completion', async
assert.equal(doc.pages[0].body, 'Saved');
assert.deepEqual(checkpoints, [{ cursor: null, document: doc }]);
});
test('Notion Sync resumes a rollup with more than 25 unverified external pages', async () => {
const { fetchForSync } = await import('../models/lib/apiImport/notionapi.js');
const remoteSource = '00aa1234-1234-1234-1234-123456789ab4';
const remotePages = Array.from({ length: 26 }, (_, index) => ({
id: '00aa1234-1234-1234-1234-' + String(index).padStart(12, '0'),
}));
const schema = { ...source, properties: { ...source.properties, Dependencies: { type: 'rollup' } } };
const seen = [];
const request = async (url, { method }) => {
if (method === 'POST') return { results: [{ ...card, properties: { ...card.properties,
Dependencies: { rollup: { type: 'array', array: [{ type: 'relation', relation: remotePages }] } },
} }], has_more: false };
if (url.endsWith(`/data_sources/${id}`)) return schema;
const target = new URL(url).pathname.split('/').at(-1);
seen.push(target);
return { object: 'page', id: target, parent: { data_source_id: remoteSource } };
};
const first = await fetchForSync(credentials, id, request, ['dependencies']);
assert.equal(first.pages[0].crossRelations, undefined);
assert.equal(first.rollupCheckpoint.targets.length, 25);
const resumed = await fetchForSync(credentials, id, request, ['dependencies'], '', undefined, first.rollupCheckpoint);
assert.deepEqual(seen, remotePages.map(page => page.id));
assert.deepEqual(resumed.pages[0].crossRelations, remotePages.map(page => ({ sourceId: remoteSource, pageId: page.id })));
assert.equal(resumed.rollupCheckpoint, undefined);
});
+373 -6
View File
@@ -89,30 +89,397 @@ test('creates each selected dependency once and preserves confirmed work package
});
});
test('uses the work package create schema for mapped durations and progress', async () => {
test('uses the work package create schema for mapped estimates and progress', async () => {
const { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues } =
await import('../models/lib/openProjectApiExport.js');
const { STORY_POINTS_FIELD } = await import('../models/lib/externalScrumPlanning.js');
const mappings = openProjectExportWorkFields([
{ _id: 'estimate', type: 'number', name: 'Estimated time (hours)' },
{ _id: 'private', type: 'number', name: 'Remaining time (hours)', adminOnly: true },
{ _id: 'points', type: 'number', name: STORY_POINTS_FIELD },
{ _id: 'progress', type: 'number', name: 'Progress (%)' },
]);
assert.deepEqual(openProjectExportWorkValues({ customFields: [
{ _id: 'estimate', value: 0 }, { _id: 'private', value: 3 }, { _id: 'progress', value: 30 },
] }, mappings), { estimatedTime: 0, percentageDone: 30 });
{ _id: 'estimate', value: 0 }, { _id: 'private', value: 3 }, { _id: 'progress', value: 30 }, { _id: 'points', value: 0 },
] }, mappings), { estimatedTime: 0, percentageDone: 30, storyPoints: 0 });
const calls = [];
const result = await createOpenProjectWorkPackages({ url: 'https://project.example', token: 'test-token' }, '7',
[{ cardId: 'one', title: 'First', workFields: { estimatedTime: 0, remainingTime: 0.00001, percentageDone: 30 } }],
[{ cardId: 'one', title: 'First', workFields: { estimatedTime: 0, remainingTime: 0.00001, percentageDone: 30, storyPoints: 0 } }],
async (url, { method, body }) => {
calls.push([new URL(url).pathname, method, { ...body }]);
if (url.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
estimatedTime: { writable: true }, percentageDone: { writable: false },
estimatedTime: { writable: true }, storyPoints: { writable: true }, percentageDone: { writable: false },
} } };
return { _type: 'WorkPackage', id: 41 };
});
assert.deepEqual(calls, [
['/api/v3/projects/7/work_packages/form', 'POST', { subject: 'First' }],
['/api/v3/projects/7/work_packages', 'POST', { subject: 'First', estimatedTime: 'PT0S' }],
['/api/v3/projects/7/work_packages', 'POST', { subject: 'First', estimatedTime: 'PT0S', storyPoints: 0 }],
]);
assert.deepEqual(result, { created: [{ cardId: 'one', id: 41 }], remaining: 0, skippedWorkFields: 2 });
});
test('exports mapped scheduling fields only when consistent and writable', async () => {
const { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues } =
await import('../models/lib/openProjectApiExport.js');
const mappings = openProjectExportWorkFields([
{ _id: 'duration', type: 'text', name: 'OpenProject scheduled duration' },
{ _id: 'days', type: 'checkbox', name: 'OpenProject allow non-working days' },
]);
const workFields = openProjectExportWorkValues({ customFields: [
{ _id: 'duration', value: 'P4D' }, { _id: 'days', value: false },
] }, mappings);
assert.deepEqual(workFields, { duration: 'P4D', ignoreNonWorkingDays: false });
const created = [];
const cards = [
{ cardId: 'one', title: 'First', startAt: new Date('2026-12-03'), workFields },
{ cardId: 'two', title: 'Second', startAt: new Date('2026-12-03'), dueAt: new Date('2026-12-09'), workFields },
];
const result = await createOpenProjectWorkPackages(credentials, '5', cards, async (url, { body }) => {
if (url.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
duration: { writable: true }, ignoreNonWorkingDays: { writable: body.subject === 'First' },
} } };
created.push(body);
return { _type: 'WorkPackage', id: created.length };
});
assert.deepEqual(created, [
{ subject: 'First', startDate: '2026-12-03', duration: 'P4D', ignoreNonWorkingDays: false },
{ subject: 'Second', startDate: '2026-12-03', dueDate: '2026-12-09' },
]);
assert.equal(result.skippedWorkFields, 2);
});
test('restores automatic scheduling after relationships and retains rejected packages', async () => {
const { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues } =
await import('../models/lib/openProjectApiExport.js');
const mappings = openProjectExportWorkFields([
{ _id: 'mode', type: 'checkbox', name: 'OpenProject manual scheduling' },
]);
const workFields = openProjectExportWorkValues({ customFields: [{ _id: 'mode', value: false }] }, mappings);
assert.deepEqual(workFields, { scheduleManually: false });
const calls = [];
const cards = [
{ cardId: 'parent', title: 'Parent', workFields },
{ cardId: 'child', title: 'Child', parentId: 'parent', workFields },
];
const result = await createOpenProjectWorkPackages(credentials, '5', cards, async (url, { method, body }) => {
const path = new URL(url).pathname.replace(/^\/subpath/, '');
calls.push({ method, path, body });
if (path === '/api/v3/projects/5/work_packages') {
return { _type: 'WorkPackage', id: calls.length };
}
const id = Number(path.split('/')[4]);
if (method === 'GET') return { _type: 'WorkPackage', id, lockVersion: 4, scheduleManually: true };
if (method === 'POST') return { _type: 'Form', _embedded: {
schema: { scheduleManually: { writable: true } },
validationErrors: id === 2 ? { scheduleManually: { message: 'Requires predecessors or children' } } : {},
} };
return { _type: 'WorkPackage', id, scheduleManually: false };
});
assert.deepEqual(calls.map(({ method, path }) => [method, path]), [
['POST', '/api/v3/projects/5/work_packages'], ['POST', '/api/v3/projects/5/work_packages'],
['GET', '/api/v3/work_packages/1'], ['POST', '/api/v3/work_packages/1/form'], ['PATCH', '/api/v3/work_packages/1'],
['GET', '/api/v3/work_packages/2'], ['POST', '/api/v3/work_packages/2/form'],
]);
assert.deepEqual(calls[1].body._links, { parent: { href: '/api/v3/work_packages/1' } });
assert.deepEqual(calls[4].body, { lockVersion: 4, scheduleManually: false });
assert.deepEqual(result, { created: [{ cardId: 'parent', id: 1 }, { cardId: 'child', id: 2 }],
remaining: 0, skippedWorkFields: 1 });
});
test('exports uniquely matched destination status and priority links', async () => {
const { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues } =
await import('../models/lib/openProjectApiExport.js');
const mappings = openProjectExportWorkFields([
{ _id: 'state', type: 'text', name: 'OpenProject work package status' },
{ _id: 'priority', type: 'text', name: 'OpenProject work package priority' },
]);
const workFields = openProjectExportWorkValues({ customFields: [
{ _id: 'state', value: 'New' }, { _id: 'priority', value: 'High' },
] }, mappings);
assert.deepEqual(workFields, { status: 'New', priority: 'High' });
const result = await createOpenProjectWorkPackages(credentials, '5',
[{ cardId: 'one', title: 'First', workFields }], async (url, { body }) => {
if (url.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
status: { writable: true, _links: { allowedValues: [
{ title: 'New', href: '/api/v3/statuses/8' }, { title: 'New', href: '/api/v3/statuses/9' },
] } },
priority: { writable: true, _embedded: { allowedValues: [
{ name: 'High', _links: { self: { href: '/api/v3/priorities/4' } } },
] }, _links: { allowedValues: [
{ title: 'High', href: 'https://invalid.example/api/v3/priorities/3' },
] } },
} } };
assert.deepEqual(body, { subject: 'First', _links: { priority: { href: '/api/v3/priorities/4' } } });
return { _type: 'WorkPackage', id: 1 };
});
assert.equal(result.skippedWorkFields, 1);
});
test('uses the matched work package type to resolve the rest of the create schema', async () => {
const { createOpenProjectWorkPackages } = await import('../models/lib/openProjectApiExport.js');
const calls = [];
const result = await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'bug', title: 'Bug', workFields: { type: 'Bug', status: 'Open' } },
], async (url, { body }) => {
calls.push(structuredClone(body));
if (!url.endsWith('/form')) return { _type: 'WorkPackage', id: 1 };
const schema = body._links?.type ? {
status: { writable: true, _links: { allowedValues: [{ title: 'Open', href: '/api/v3/statuses/9' }] } },
} : {
type: { writable: true, _links: { allowedValues: [{ title: 'Bug', href: '/api/v3/types/3' }] } },
status: { writable: true, _links: { allowedValues: [{ title: 'Open', href: '/api/v3/statuses/2' }] } },
};
return { _type: 'Form', _embedded: { schema } };
});
const type = { href: '/api/v3/types/3' };
assert.deepEqual(calls, [
{ subject: 'Bug' },
{ subject: 'Bug', _links: { type } },
{ subject: 'Bug', _links: { type, status: { href: '/api/v3/statuses/9' } } },
]);
assert.deepEqual(result, { created: [{ cardId: 'bug', id: 1 }], remaining: 0 });
});
test('exports mapped target and observed versions with the destination link shape', async () => {
const { createOpenProjectWorkPackages, openProjectExportLabelValues } = await import('../models/lib/openProjectApiExport.js');
const workFields = openProjectExportLabelValues(['version:Next', 'observed-in:Last', 'unrelated', 'version:Next']);
assert.deepEqual(workFields, { targetVersions: ['Next'], observedInVersions: ['Last'] });
const property = (title, id) => ({ writable: true, _links: { allowedValues: [{ title, href: '/api/v3/versions/' + id }] } });
for (const target of ['version', 'targetVersions']) {
const result = await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'one', title: 'First', workFields },
], async (url, { body }) => {
if (url.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
[target]: property('Next', 4), observedInVersions: property('Last', 8),
} } };
const next = { href: '/api/v3/versions/4' };
assert.deepEqual(body._links, { [target]: target === 'version' ? next : [next],
observedInVersions: [{ href: '/api/v3/versions/8' }] });
return { _type: 'WorkPackage', id: 1 };
});
assert.equal(result.skippedWorkFields, undefined);
}
});
test('exports categories and project phase from imported labels', async () => {
const { createOpenProjectWorkPackages, openProjectExportLabelValues } = await import('../models/lib/openProjectApiExport.js');
const workFields = openProjectExportLabelValues(['OpenProject category: Incident', 'OpenProject phase: Delivery']);
assert.deepEqual(workFields, { categories: ['Incident'], projectPhase: ['Delivery'] });
const property = (title, href) => ({ writable: true, _links: { allowedValues: [{ title, href }] } });
for (const field of ['categories', 'category']) {
await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'one', title: 'First', workFields },
], async (url, { body }) => {
if (url.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
[field]: property('Incident', '/api/v3/categories/4'),
projectPhase: property('Delivery', '/api/v3/project_phases/9'),
} } };
const category = { href: '/api/v3/categories/4' };
assert.deepEqual(body._links, { [field]: field === 'category' ? category : [category],
projectPhase: { href: '/api/v3/project_phases/9' } });
return { _type: 'WorkPackage', id: 1 };
});
}
});
test('resolves labels from the destination workspace collection', async () => {
const { createOpenProjectWorkPackages, openProjectExportLabelValues } = await import('../models/lib/openProjectApiExport.js');
const workFields = openProjectExportLabelValues(['OpenProject label: Urgent', 'Unrelated']);
assert.deepEqual(workFields, { labels: ['Urgent'] });
const calls = [];
const result = await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'one', title: 'First', workFields },
], async (url, { method, body }) => {
const { pathname, searchParams } = new URL(url);
calls.push(pathname);
if (pathname.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
labels: { writable: true, _links: { allowedValues: { href: '/api/v3/workspaces/5/labels' } } },
} } };
if (method === 'GET') {
const offset = Number(searchParams.get('offset'));
const id = offset === 1 ? 3 : 8;
return { _type: 'Collection', offset, total: 2, _embedded: { elements: [
{ _type: 'Label', id, name: offset === 1 ? 'Other' : 'Urgent', _links: { self: { href: '/api/v3/labels/' + id } } },
] } };
}
assert.deepEqual(body._links, { labels: [{ href: '/api/v3/labels/8' }] });
return { _type: 'WorkPackage', id: 1 };
});
assert.equal(calls.filter(path => path.endsWith('/workspaces/5/labels')).length, 2);
assert.equal(result.skippedWorkFields, undefined);
});
test('ignores a label collection belonging to a different workspace', async () => {
const { createOpenProjectWorkPackages } = await import('../models/lib/openProjectApiExport.js');
const result = await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'one', title: 'First', workFields: { labels: ['Urgent'] } },
], async (url, { method, body }) => {
assert.equal(method, 'POST');
if (url.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
labels: { writable: true, _links: { allowedValues: { href: '/api/v3/workspaces/6/labels' } } },
} } };
assert.deepEqual(body, { subject: 'First' });
return { _type: 'WorkPackage', id: 1 };
});
assert.equal(result.skippedWorkFields, 1);
});
test('exports multiple target versions only when the create form confirms them', async () => {
const { createOpenProjectWorkPackages } = await import('../models/lib/openProjectApiExport.js');
const links = [{ href: '/api/v3/versions/4' }, { href: '/api/v3/versions/8' }];
for (const mode of ['accepted', 'rejected', 'truncated']) {
const result = await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'one', title: 'First', workFields: { targetVersions: ['Next', 'Later'] } },
], async (url, { body }) => {
if (!url.endsWith('/form')) {
assert.deepEqual(body._links, mode === 'accepted' ? { targetVersions: links } : undefined);
return { _type: 'WorkPackage', id: 1 };
}
if (!body._links) return { _type: 'Form', _embedded: { schema: {
targetVersions: { writable: true, _links: { allowedValues: links.map((link, index) =>
({ ...link, title: index ? 'Later' : 'Next' })) } },
} } };
return { _type: 'Form', _embedded: {
validationErrors: mode === 'rejected' ? { targetVersions: {} } : {},
payload: { _links: { targetVersions: mode === 'truncated' ? links.slice(0, 1) : links } },
} };
});
assert.equal(result.skippedWorkFields, mode === 'accepted' ? undefined : 1);
}
});
test('OpenProject assignment matches one destination user and rejects ambiguous or missing matches', async () => {
const { createOpenProjectWorkPackages } = await import('../models/lib/openProjectApiExport.js');
const sent = [];
let reads = 0;
const path = '/api/v3/workspaces/5/available_assignees';
const user = (name, href) => ({ name, _links: { self: { href } } });
const result = await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'one', title: 'First', assigneeName: 'Alex' },
{ cardId: 'two', title: 'Second', assigneeName: 'Taylor' },
{ cardId: 'three', title: 'Third', assigneeName: 'Group' },
{ cardId: 'four', title: 'Fourth', assigneeName: '' },
], async (url, { method, body }) => {
if (url.endsWith('/form')) {
assert.equal(body.assigneeName, undefined);
return { _type: 'Form', _embedded: { schema: {
assignee: { writable: true, _links: { allowedValues: { href: path } } },
} } };
}
if (method === 'GET') {
reads += 1;
assert.equal(url, credentials.url + path + '?offset=1&pageSize=100');
return { _type: 'Collection', offset: 1, total: 4, _embedded: { elements: [
user('Alex', '/api/v3/users/11'), user('Taylor', '/api/v3/users/12'),
user('Taylor', '/api/v3/users/13'), user('Group', '/api/v3/groups/14'),
] } };
}
sent.push(body);
return packageResponse(sent.length);
});
assert.equal(reads, 1);
assert.deepEqual(sent, [
{ subject: 'First', _links: { assignee: { href: '/api/v3/users/11' } } },
{ subject: 'Second' }, { subject: 'Third' }, { subject: 'Fourth' },
]);
assert.equal(result.skippedWorkFields, 3);
});
test('exports a milestone date only when the selected type confirms the date field', async () => {
const { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues } =
await import('../models/lib/openProjectApiExport.js');
const mappings = openProjectExportWorkFields([
{ _id: 'milestone', name: 'OpenProject milestone', type: 'checkbox' },
{ _id: 'type', name: 'OpenProject work package type', type: 'text' },
]);
const workFields = openProjectExportWorkValues({ customFields: [
{ _id: 'milestone', value: true }, { _id: 'type', value: 'Gate' },
] }, mappings);
assert.deepEqual(workFields, { milestone: true, type: 'Gate' });
const type = { href: '/api/v3/types/8' };
const form = schema => ({ _type: 'Form', _embedded: { schema } });
for (const [schema, dateFields, skipped] of [
[{ date: { type: 'Date', writable: true } }, { date: '2026-12-09' }, undefined],
[{ date: { type: 'Date', writable: false } }, {}, 1],
[{ dueDate: { type: 'Date', writable: true } }, { dueDate: '2026-12-09' }, 1],
]) {
let count = 0;
const result = await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'milestone', title: 'Release gate', dueAt: '2026-12-09', workFields },
], async (url, { body }) => {
count += 1;
if (count === 1) {
assert.match(url, /\/form$/);
assert.deepEqual(body, { subject: 'Release gate' });
return form({ type: { writable: true, _links: { allowedValues: [{ ...type, title: 'Gate' }] } } });
}
if (count === 2) {
assert.match(url, /\/form$/);
assert.deepEqual(body, { subject: 'Release gate', _links: { type } });
return form(schema);
}
assert.equal(url, credentials.url + '/api/v3/projects/5/work_packages');
assert.deepEqual(body, { subject: 'Release gate', _links: { type }, ...dateFields });
return packageResponse(1);
});
assert.equal(count, 3);
assert.equal(result.skippedWorkFields, skipped);
}
});
test('exports budget names only when the create schema offers a unique writable budget', async () => {
const { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues } =
await import('../models/lib/openProjectApiExport.js');
const definition = { _id: 'budget', name: 'OpenProject budget name', type: 'text' };
const mappings = openProjectExportWorkFields([definition]);
assert.equal(openProjectExportWorkFields([{ ...definition, adminOnly: true }]).size, 0);
const workFields = openProjectExportWorkValues({ customFields: [{ _id: 'budget', value: 'Operations' }] }, mappings);
assert.deepEqual(workFields, { budget: 'Operations' });
const href = '/api/v3/budgets/12';
const option = { title: 'Operations', href };
for (const [writable, allowedValues, expected] of [
[true, [option], { budget: { href } }],
[false, [option], undefined],
[true, [option, { ...option, href: '/api/v3/budgets/13' }], undefined],
[true, [{ ...option, href: '/api/v3/projects/12' }], undefined],
]) {
const result = await createOpenProjectWorkPackages(credentials, '5', [
{ cardId: 'one', title: 'First', workFields },
], async (url, { body }) => {
if (url.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
budget: { writable, _links: { allowedValues } },
} } };
assert.deepEqual(body._links, expected);
return packageResponse(1);
});
assert.equal(result.skippedWorkFields, expected ? undefined : 1);
}
});
test('resolves budgets only from a complete collection for the selected project', async () => {
const { createOpenProjectWorkPackages } = await import('../models/lib/openProjectApiExport.js');
const path = '/api/v3/projects/5/budgets';
for (const [advertisedPath, total, expected] of [[path, 1, true], [path, 2, false], ['/api/v3/projects/8/budgets', 1, false]]) {
let reads = 0;
let writes = 0;
const result = await createOpenProjectWorkPackages(credentials, '5', cards.slice(0, 2).map(card => ({
...card, workFields: { budget: 'Operations' },
})), async (url, { method, body }) => {
if (url.endsWith('/form')) return { _type: 'Form', _embedded: { schema: {
budget: { writable: true, _links: { allowedValues: { href: advertisedPath } } },
} } };
if (method === 'GET') {
assert.equal(url, credentials.url + path);
reads++;
return { _type: 'Collection', total, count: 1, _embedded: { elements: [
{ _type: 'Budget', id: 12, subject: 'Operations', _links: { self: { href: '/api/v3/budgets/12' } } },
] } };
}
assert.deepEqual(body._links, expected ? { budget: { href: '/api/v3/budgets/12' } } : undefined);
return packageResponse(++writes);
});
assert.equal(reads, advertisedPath === path ? 1 : 0);
assert.equal(result.skippedWorkFields, expected ? undefined : 2);
}
});
+11
View File
@@ -59,9 +59,20 @@ async function main() {
assert.deepEqual(task.watchers, ['op-assignee']);
const watched = planImportedTask(task, { members: { 'op-assignee': 'u1' }, boardMemberIds: ['u1'] });
assert.deepEqual([watched.watcherIds, watched.unwatchedCount], [['u1'], 0]);
const assigned = planImportedTask(task, { source: 'openproject',
members: { 'op-assignee': 'u1' }, boardMemberIds: ['u1'] });
assert.deepEqual(assigned.card.assignees, ['u1']);
assert.equal(watched.card.assignees, undefined, 'generic import keeps its membership behavior');
assert.equal(planImportedTask(task, { source: 'openproject',
members: { 'op-assignee': 'u1' }, boardMemberIds: [] }).card.assignees, undefined);
const unmapped = planImportedTask(task, { members: {}, boardMemberIds: ['u1'] });
assert.deepEqual([unmapped.watcherIds, unmapped.unwatchedCount], [[], 1], 'an unmapped watcher is counted');
const { scopedExternalDocument } = await import('../models/lib/scopedExternalImport.js');
const peopleMapping = [{ source: 'op-assignee', userId: 'u1' }];
assert.deepEqual(scopedExternalDocument(fixture, { peopleMapping }).cards[0].assignees, ['u1']);
assert.equal(scopedExternalDocument(fixture, { peopleMapping, includePeople: false }).cards[0].assignees, undefined);
const plan = planImportedTask(task, { members: {} });
assert.equal(plan.card.startAt.toISOString(), '2026-09-01T00:00:00.000Z');
assert.equal(plan.card.createdAt.toISOString(), '2026-08-01T10:00:00.000Z');
+11 -1
View File
@@ -199,7 +199,10 @@ test('OpenProject field selection filters embedded data from an export before pa
id: 1, subject: 'Task', customField7: 3, customComment7: 'Review reason', duration: 'P2D', spentTime: 'PT1H', dueDate: '2026-11-30',
updatedAt: '2026-11-29T12:00:00Z', derivedStartDate: '2026-11-28',
derivedEstimatedTime: 'PT2H', derivedPercentageDone: 50, scheduleManually: false, readonly: true,
_links: { customField8: { title: 'Option' } },
_links: {
customField8: { title: 'Option' }, assignee: { title: 'Source assignee' },
responsible: { title: 'Source responsible' }, author: { title: 'Source author' },
},
_embedded: { activities: [{ comment: { raw: 'Note' } }],
attachments: [{ _links: { downloadLocation: { href: '/api/v3/attachments/1/content' } } }] },
}] } };
@@ -211,6 +214,13 @@ test('OpenProject field selection filters embedded data from an export before pa
assert.equal(task.spent_hours, undefined);
assert.equal(task.date_due, undefined);
assert.equal(task.date_modified, undefined);
assert.equal(task.owner_username, undefined);
assert.deepEqual(task.assignees, []);
assert.equal(task.requested_by, undefined);
const [people] = parseOpenProject(pruneImportDocument(structuredClone(doc), ['people'], 'openproject')).tasks;
assert.equal(people.owner_username, 'Source assignee');
assert.deepEqual(people.assignees, ['Source responsible']);
assert.equal(people.requested_by, 'Source author');
const [dates] = parseOpenProject(pruneImportDocument(structuredClone(doc), ['dates'], 'openproject')).tasks;
assert.equal(dates.date_modified, '2026-11-29T12:00:00Z');
assert.deepEqual(dates.custom_fields, { 'OpenProject last updated': dates.date_modified });
+164 -13
View File
@@ -363,6 +363,9 @@ test('API batch selection reports each project and keeps failed projects availab
meteor.applyAsync = function (name, ...args) {
if (name !== 'apiImportProjects') return originalApply.call(this, name, ...args);
window.__projectImportCalls.push(args);
if (args[0][0] === 'notionapi' && args[0][2].length === 1) {
return Promise.resolve([{ id: 'B', ok: false, error: 'import-too-large' }]);
}
return Promise.resolve([{ id: 'A', ok: true },
{ id: 'B', ok: false, error: args[0][0] === 'notionapi' ? 'history-request-retry' : 'api-import-failed' }]);
};
@@ -387,6 +390,13 @@ test('API batch selection reports each project and keeps failed projects availab
expect(args[2]).toEqual(['A', 'B']);
expect(args[5]).toBe(service === 'jira');
expect(options.noRetry).toBe(true);
if (service === 'notionapi') {
await page.locator('#api-import-token').fill('test-token');
await page.locator('.js-api-import-select-all').click();
await page.locator('.js-api-import-projects').click();
await expect(results.locator('.is-failed')).toContainText('too large to import');
await expect(page.locator('.js-api-import-item option')).toHaveText(['Second project']);
}
}
});
@@ -653,7 +663,48 @@ for (const [service, title] of [
for (const scope of ['card', 'list']) test(`OpenProject API export sends only the selected WeKan ${scope} to the chosen project`, async ({ boardPage: page, board }) => {
const calls = [];
const isMilestone = scope === 'card';
const dateRange = { startDate: '2026-12-03', dueDate: '2026-12-09' };
const typeName = isMilestone ? 'Gate' : 'Bug';
const boardDoc = db.findOne('boards', { _id: board.boardId });
const assignee = db.findOne('users', { _id: boardDoc.members[0].userId });
const assigneeName = assignee.profile?.fullname || assignee.username;
const versions = [{ href: '/api/v3/versions/4' }, { href: '/api/v3/versions/7' }];
const server = http.createServer((request, response) => {
if (request.method === 'GET' && request.url === '/api/v3/work_packages/21') {
calls.push({ method: 'GET', path: request.url });
response.writeHead(200, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify({
_type: 'WorkPackage', id: 21, lockVersion: 4, scheduleManually: true,
}));
return;
}
if (request.method === 'GET' && request.url.startsWith('/api/v3/workspaces/7/labels?')) {
calls.push({ method: 'GET', path: request.url });
response.writeHead(200, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify({
_type: 'Collection', offset: 1, total: 1, _embedded: { elements: [
{ _type: 'Label', id: 8, name: 'Urgent', _links: { self: { href: '/api/v3/labels/8' } } },
] },
}));
return;
}
if (request.method === 'GET' && request.url.startsWith('/api/v3/workspaces/7/available_assignees?')) {
calls.push({ method: 'GET', path: request.url });
response.writeHead(200, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify({
_type: 'Collection', offset: 1, total: 1, _embedded: { elements: [
{ _type: 'User', name: assigneeName, _links: { self: { href: '/api/v3/users/11' } } },
] },
}));
return;
}
if (request.method === 'GET' && request.url === '/api/v3/projects/7/budgets') {
calls.push({ method: 'GET', path: request.url });
response.writeHead(200, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify({
_type: 'Collection', total: 1, count: 1, _embedded: { elements: [
{ _type: 'Budget', id: 12, subject: 'Operations', _links: { self: { href: '/api/v3/budgets/12' } } },
] },
}));
return;
}
if (request.method === 'GET') {
calls.push({ method: 'GET', path: new URL(request.url, 'http://localhost').pathname });
response.writeHead(200, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify({
@@ -666,14 +717,37 @@ for (const scope of ['card', 'list']) test(`OpenProject API export sends only th
request.on('data', chunk => { body += chunk; });
request.on('end', () => {
calls.push({ path: request.url, method: request.method, body: JSON.parse(body) });
if (request.url === '/api/v3/work_packages/21/form' || request.method === 'PATCH') {
const result = request.method === 'PATCH'
? { _type: 'WorkPackage', id: 21, scheduleManually: false }
: { _type: 'Form', _embedded: { schema: { scheduleManually: { writable: true } }, validationErrors: {} } };
response.writeHead(200, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify(result));
return;
}
if (request.url.endsWith('/form') && JSON.parse(body)._links?.targetVersions?.length > 1) {
response.writeHead(200, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify({
_type: 'Form', _embedded: { validationErrors: {}, payload: { _links: { targetVersions: versions } } },
}));
return;
}
if (request.url.endsWith('/form')) {
response.writeHead(200, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify({
_type: 'Form', _embedded: { schema: { estimatedTime: { writable: true }, percentageDone: { writable: scope === 'card' } } },
_type: 'Form', _embedded: { schema: {
budget: { writable: true, _links: { allowedValues: { href: '/api/v3/projects/7/budgets' } } },
assignee: { writable: true, _links: { allowedValues: { href: '/api/v3/workspaces/7/available_assignees' } } },
labels: { writable: true, _links: { allowedValues: { href: '/api/v3/workspaces/7/labels' } } },
categories: { writable: true, _links: { allowedValues: [{ title: 'Incident', href: '/api/v3/categories/4' }] } },
projectPhase: { writable: true, _links: { allowedValues: [{ title: 'Delivery', href: '/api/v3/project_phases/9' }] } },
targetVersions: { writable: true, _links: { allowedValues: versions.map((link, index) => ({ ...link, title: index ? 'Later' : 'Next' })) } },
type: { writable: true, _links: { allowedValues: [{ title: typeName, href: '/api/v3/types/3' }] } },
priority: { writable: JSON.parse(body)._links?.type?.href === '/api/v3/types/3', _links: { allowedValues: [{ title: 'High', href: '/api/v3/priorities/4' }] } },
...(isMilestone && JSON.parse(body)._links?.type ? { date: { type: 'Date', writable: true } } : {}),
estimatedTime: { writable: true }, storyPoints: { writable: true }, ignoreNonWorkingDays: { writable: true }, percentageDone: { writable: scope === 'card' } } },
}));
return;
}
const result = request.url.endsWith('/relations') ? { _type: 'Relation', id: 101 } : {
_type: 'WorkPackage', id: 19 + calls.filter(call => !call.path.endsWith('/form')).length, _links: { project: { href: '/api/v3/projects/7' } },
_type: 'WorkPackage', id: 20 + calls.filter(call => call.method === 'POST' && call.path === '/api/v3/projects/7/work_packages').length, _links: { project: { href: '/api/v3/projects/7' } },
};
response.writeHead(201, { 'Content-Type': 'application/hal+json' }).end(JSON.stringify(result));
});
@@ -681,12 +755,35 @@ for (const scope of ['card', 'list']) test(`OpenProject API export sends only th
const url = await listenReachable(server);
try {
const card = db.findOne('cards', { boardId: board.boardId, title: 'Alpha Card' });
db.updateOne('boards', { _id: board.boardId }, { $set: { labels: [
{ _id: 'work-package-label', name: 'OpenProject label: Urgent', color: 'red' },
{ _id: 'version-label', name: 'version:Next', color: 'green' },
{ _id: 'later-version-label', name: 'version:Later', color: 'green' },
{ _id: 'category-label', name: 'OpenProject category: Incident', color: 'blue' },
{ _id: 'phase-label', name: 'OpenProject phase: Delivery', color: 'yellow' },
] } });
const estimated = db.uid('estimate');
const progress = db.uid('progress');
const points = db.uid('points');
db.insertOne('customFields', { _id: points, boardIds: [board.boardId], name: 'Story points', type: 'number' });
const budget = db.uid('budget');
db.insertOne('customFields', { _id: budget, boardIds: [board.boardId], name: 'OpenProject budget name', type: 'text' });
const priority = db.uid('priority');
const type = db.uid('type');
const milestone = db.uid('milestone');
db.insertOne('customFields', { _id: milestone, boardIds: [board.boardId], name: 'OpenProject milestone', type: 'checkbox' });
db.insertOne('customFields', { _id: type, boardIds: [board.boardId], name: 'OpenProject work package type', type: 'text' });
db.insertOne('customFields', { _id: priority, boardIds: [board.boardId], name: 'OpenProject work package priority', type: 'text' });
const nonWorkingDays = db.uid('nonWorkingDays');
const manualScheduling = db.uid('manualScheduling');
db.insertOne('customFields', { _id: manualScheduling, boardIds: [board.boardId], name: 'OpenProject manual scheduling', type: 'checkbox' });
db.insertOne('customFields', { _id: nonWorkingDays, boardIds: [board.boardId], name: 'OpenProject allow non-working days', type: 'checkbox' });
db.insertOne('customFields', { _id: estimated, boardIds: [board.boardId], name: 'Estimated time (hours)', type: 'number' });
db.insertOne('customFields', { _id: progress, boardIds: [board.boardId], name: 'Progress (%)', type: 'number' });
db.updateOne('cards', { _id: card._id }, { $set: {
customFields: [{ _id: estimated, value: 1.5 }, { _id: progress, value: 40 }], description: 'Details to omit', startAt: new Date('2026-12-03T13:00:00Z'), dueAt: new Date('2026-12-09T15:00:00Z') } });
assignees: [assignee._id],
labelIds: ['work-package-label', 'version-label', 'category-label', 'phase-label', ...(scope === 'card' ? ['later-version-label'] : [])], customFields: [{ _id: budget, value: 'Operations' }, { _id: type, value: typeName }, { _id: milestone, value: isMilestone }, { _id: priority, value: 'High' }, { _id: estimated, value: 1.5 }, { _id: points, value: 0 }, { _id: progress, value: 40 }, { _id: nonWorkingDays, value: false },
...(scope === 'list' ? [{ _id: manualScheduling, value: false }] : [])], description: 'Details to omit', startAt: isMilestone ? null : new Date('2026-12-03T13:00:00Z'), dueAt: new Date('2026-12-09T15:00:00Z') } });
if (scope === 'list') {
db.updateOne('cards', { boardId: board.boardId, title: 'Beta Card' }, {
$set: { listId: card.listId, swimlaneId: card.swimlaneId, parentId: 'outside-selection', parentIds: ['outside-selection', card._id], sort: -1,
@@ -703,6 +800,10 @@ for (const scope of ['card', 'list']) test(`OpenProject API export sends only th
if (await description.getAttribute('aria-checked') === 'true') await description.click();
const workFields = page.locator('.js-export-field-toggle[data-field="custom-fields"]');
if (await workFields.getAttribute('aria-checked') !== 'true') await workFields.click();
const labels = page.locator('.js-export-field-toggle[data-field="labels"]');
if (await labels.getAttribute('aria-checked') !== 'true') await labels.click();
const people = page.locator('.js-export-field-toggle[data-field="people"]');
if ((await people.getAttribute('aria-checked') === 'true') !== (scope === 'card')) await people.click();
await page.getByText('OpenProject API', { exact: true }).click();
const form = page.locator('details').filter({ has: page.getByText('OpenProject API', { exact: true }) }).locator('form');
await form.locator('[name="url"]').fill(url);
@@ -722,15 +823,30 @@ for (const scope of ['card', 'list']) test(`OpenProject API export sends only th
expect(calls).toEqual([
{ method: 'GET', path: '/api/v3/projects' },
{ path: '/api/v3/projects/7/work_packages/form', method: 'POST', body: {
subject: 'Alpha Card', startDate: '2026-12-03', dueDate: '2026-12-09' } },
{ path: '/api/v3/projects/7/work_packages', method: 'POST', body: {
subject: 'Alpha Card', startDate: '2026-12-03', dueDate: '2026-12-09',
estimatedTime: 'PT5400S', ...(scope === 'card' ? { percentageDone: 40 } : {}),
} },
subject: 'Alpha Card', ...(isMilestone ? {} : dateRange) } },
{ path: '/api/v3/projects/7/work_packages/form', method: 'POST', body: {
subject: 'Alpha Card', ...(isMilestone ? {} : dateRange), _links: { type: { href: '/api/v3/types/3' } } } },
{ path: '/api/v3/workspaces/7/labels?offset=1&pageSize=100', method: 'GET' },
{ path: '/api/v3/projects/7/budgets', method: 'GET' },
...(scope === 'card' ? [{ path: '/api/v3/workspaces/7/available_assignees?offset=1&pageSize=100', method: 'GET' }] : []),
...[...(scope === 'card' ? ['/form'] : []), ''].map(suffix => ({
path: '/api/v3/projects/7/work_packages' + suffix, method: 'POST', body: {
subject: 'Alpha Card', ...(isMilestone ? { date: '2026-12-09' } : dateRange),
estimatedTime: 'PT5400S', storyPoints: 0, ignoreNonWorkingDays: false,
_links: { type: { href: '/api/v3/types/3' }, targetVersions: scope === 'card' ? versions : versions.slice(0, 1),
categories: [{ href: '/api/v3/categories/4' }], labels: [{ href: '/api/v3/labels/8' }],
...(scope === 'card' ? { assignee: { href: '/api/v3/users/11' } } : {}),
projectPhase: { href: '/api/v3/project_phases/9' }, budget: { href: '/api/v3/budgets/12' }, priority: { href: '/api/v3/priorities/4' } },
...(scope === 'card' ? { percentageDone: 40 } : {}),
},
})),
...(scope === 'list' ? [{ path: '/api/v3/projects/7/work_packages', method: 'POST',
body: { subject: 'Beta Card', _links: { parent: { href: '/api/v3/work_packages/21' } } } },
{ path: '/api/v3/work_packages/21/relations', method: 'POST',
body: { type: 'blocks', _links: { to: { href: '/api/v3/work_packages/22' } } } }] : []),
body: { type: 'blocks', _links: { to: { href: '/api/v3/work_packages/22' } } } },
{ path: '/api/v3/work_packages/21', method: 'GET' },
{ path: '/api/v3/work_packages/21/form', method: 'POST', body: { lockVersion: 4, scheduleManually: false } },
{ path: '/api/v3/work_packages/21', method: 'PATCH', body: { lockVersion: 4, scheduleManually: false } }] : []),
]);
} finally {
await new Promise(resolve => server.close(resolve));
@@ -799,7 +915,7 @@ for (const exportMode of ['included', 'hidden in Jira', 'deselected', 'relations
settings: { jiraTimeField: 'original' } });
db.updateOne('cards', { _id: card._id }, { $set: {
customFields: [{ _id: estimateId, value: 1.5 }],
description: '<span style="color:red">Review <span style="background-color:#fedec8">**Warning**</span> [now](https://example.test/guide) with `--help`</span>', startAt: new Date('2026-12-07T15:00:00Z'), dueAt: new Date('2026-12-09T15:00:00Z'), labelIds: ['labelone', 'release', 'component'],
description: '<!-- jira-panel:title%3DReview -->\n\n<span style="color:red">Review <span style="background-color:#fedec8">**Warning**</span> [now](https://example.test/guide) with `--help`</span>. <u class="discard">Underline</u> H<sub>2</sub>O x<sup>2</sup> <cite>Handbook</cite>\n\n<!-- /jira-panel -->', startAt: new Date('2026-12-07T15:00:00Z'), dueAt: new Date('2026-12-09T15:00:00Z'), labelIds: ['labelone', 'release', 'component'],
} });
if (listExport) db.updateOne('cards', { boardId: board.boardId, title: 'Beta Card' }, {
$set: { listId: card.listId, swimlaneId: card.swimlaneId, sort: (card.sort || 0) - 1, parentId: 'outside-selection', parentIds: ['outside-selection', card._id],
@@ -860,7 +976,7 @@ for (const exportMode of ['included', 'hidden in Jira', 'deselected', 'relations
.map(path => ({ path, method: 'GET', auth: 'Bearer test-token' })),
{ path: '/rest/api/2/issue', method: 'POST', auth: 'Bearer test-token',
body: { fields: { project: { key: 'PROJ' }, issuetype: { id: '10000' }, summary: 'Alpha Card',
...(includeDescription ? { description: '{color:red}Review *Warning* [now|https://example.test/guide] with {{--help}}{color}' } : {}),
...(includeDescription ? { description: '{panel:title=Review}\n{color:red}Review *Warning* [now|https://example.test/guide] with {{--help}}{color}. +Underline+ H~2~O x^2^ ??Handbook??\n{panel}' } : {}),
...(dueDateAvailable ? { duedate: '2026-12-09', customfield_10400: '2026-12-07', components: [{ id: '6' }], priority: { id: '2' }, fixVersions: [{ id: '4' }], timetracking: { originalEstimate: '90m' } } : {}) } } },
...(listExport ? [
{ path: '/rest/api/2/issue', method: 'POST', auth: 'Bearer test-token',
@@ -1068,6 +1184,8 @@ test('Notion API fetch restores encrypted progress after reload', async ({ logge
test('Notion API documents become cards in lists with their dates and labels', async ({ loggedInPage: page }) => {
let boardId;
const body = '## Checklist\n- Read pressure\n - Recovered detail\n\n' +
'Long Notion page. '.repeat(350000) + '\n\nEnd of imported page';
try {
await navigateInApp(page, '/import');
const notion = page.locator('.js-select-import-source[data-source="notion"]');
@@ -1079,7 +1197,7 @@ test('Notion API documents become cards in lists with their dates and labels', a
await page.locator('#import-textarea').fill(JSON.stringify({
source: { name: 'Notion project', statuses: ['Doing', 'Done'] },
pages: [{ id: '00aa1234-1234-1234-1234-123456789abc', title: 'Inspect pump', description: 'Computed summary',
body: '## Checklist\n- Read pressure\n - Recovered detail', status: 'Doing', tags: ['Maintenance', 'Urgent'], start: '2026-11-29', due: '2026-12-03' }],
body, status: 'Doing', tags: ['Maintenance', 'Urgent'], start: '2026-11-29', due: '2026-12-03' }],
}));
await page.locator('.js-import-without-mapping').click();
await waitForImportedBoard(page);
@@ -1088,7 +1206,9 @@ test('Notion API documents become cards in lists with their dates and labels', a
const board = db.findOne('boards', { _id: boardId });
const card = db.findOne('cards', { boardId, title: 'Inspect pump' });
expect(board.title).toBe('Notion project');
expect(card.description).toBe('Computed summary\n\n## Checklist\n- Read pressure\n - Recovered detail');
expect(card.description.length).toBe('Computed summary\n\n'.length + body.length);
expect(card.description.startsWith('Computed summary\n\n## Checklist')).toBe(true);
expect(card.description.endsWith('End of imported page')).toBe(true);
expect(db.findOne('lists', { _id: card.listId }).title).toBe('Doing');
expect(card.labelIds).toEqual(expect.arrayContaining(
['Maintenance', 'Urgent'].map(name => board.labels.find(label => label.name === name)._id)));
@@ -1097,3 +1217,34 @@ test('Notion API documents become cards in lists with their dates and labels', a
if (boardId) db.cleanup({ boardIds: [boardId] });
}
});
test('Jira Cloud import shows media references inside expandable card descriptions', async ({ loggedInPage: page }) => {
let boardId;
try {
await navigateInApp(page, '/import');
await page.locator('.js-select-import-source[data-source="jira"]').click();
await page.locator('#import-textarea').fill(JSON.stringify({ issues: [{
key: 'PROJ-1',
fields: { summary: 'Check the media', status: { name: 'To do' },
description: { type: 'doc', version: 1, content: [{ type: 'expand',
attrs: { title: 'Supporting files' }, content: [
{ type: 'paragraph', content: [{ type: 'text', text: 'Read this first' }] },
{ type: 'mediaSingle', attrs: { layout: 'center' }, content: [
{ type: 'media', attrs: { id: 'existing-media-id', type: 'file', collection: 'jira' } },
] },
],
}] },
},
}] }));
await page.locator('.js-import-without-mapping').click();
await waitForImportedBoard(page);
boardId = page.url().match(/\/b\/([^/]+)/)[1];
await page.locator('.minicard-title', { hasText: 'Check the media' }).click();
const disclosure = page.locator('.js-card-details details').filter({ hasText: 'Supporting files' });
await disclosure.locator('summary').click();
await expect(disclosure.locator('code')).toHaveText('[Jira media 1]');
await expect(disclosure).toContainText('Read this first');
} finally {
if (boardId) db.cleanup({ boardIds: [boardId] });
}
});
+11 -3
View File
@@ -274,6 +274,7 @@ test('a checkbox and its label are a space apart, on the rows and in the hamburg
test('sections drag like checklists, rows within their section; sections collapse', async ({ boardPage: page, board, user }) => {
db.updateOne('users', { _id: user.id }, { $set: { 'profile.showDesktopDragHandles': false } });
await page.reload();
const details = await openCard(page, board);
const inline = await openCardSettings(page);
// Both ends on screen: the target scrolled to the top, the source (a few
@@ -307,14 +308,21 @@ test('sections drag like checklists, rows within their section; sections collaps
await page.keyboard.press('ArrowDown');
await expect.poll(() => {
const order = db.findOne('boards', { _id: board.boardId }).cardSettingsSectionOrder || [];
return order.indexOf('members') > order.indexOf('date');
return order.indexOf('date') !== -1 && order.indexOf('members') > order.indexOf('date');
}).toBe(true);
await expect.poll(() => inline.locator('.js-card-settings-section')
.evaluateAll(els => {
const ids = els.map(el => el.dataset.section);
return ids.indexOf('date') !== -1 && ids.indexOf('members') > ids.indexOf('date');
})).toBe(true);
// A row within its section: Due dragged above Received moves it on the card.
const date = sectionOf(inline, 'date');
await drag(itemOf(date, 'dueDate').locator('.card-settings-line-label'), itemOf(date, 'receivedDate'));
const dueHandle = itemOf(date, 'dueDate').locator('.card-settings-line-label.js-card-field-order-handle');
await expect(dueHandle).toBeVisible();
await drag(dueHandle, itemOf(date, 'receivedDate'));
await expect.poll(() => {
const order = db.findOne('boards', { _id: board.boardId }).cardFieldOrder || [];
return order.indexOf('dueDate') < order.indexOf('receivedDate');
return order.indexOf('dueDate') !== -1 && order.indexOf('dueDate') < order.indexOf('receivedDate');
}).toBe(true);
// Collapsed: the rows hidden, the title and its count still there; kept per user.
await date.locator('.js-toggle-card-settings-section').click();
@@ -42,7 +42,8 @@ test('label names preserve multiple lines when saved and reopened', async ({ boa
await expect(input).toHaveCSS('resize', 'both');
await pop.locator('.js-palette-color').first().click();
await pop.locator('button.primary, button[type=submit]').first().click();
await expect.poll(() => db.findOne('boards', { _id: board.boardId }).labels.some(l => l.name === 'First line\nSecond line')).toBe(true);
await expect.poll(() => db.findOne('boards', { _id: board.boardId })?.labels ?? [])
.toContainEqual(expect.objectContaining({ name: 'First line\nSecond line' }));
// Create goes back to the Labels popup and the card stays open, so clicking
// its minicard again would close it. Close the popup and reopen the editor.
await expect(pop.locator('li.js-card-label-item').filter({ hasText: 'First line' })).toHaveCount(1);
@@ -274,19 +274,31 @@ test('OpenProject work package values survive import and export', async ({ reque
}
});
test('OpenProject selective import respects the Dates and Custom Fields selections', async ({ loggedInPage: page }) => {
test('OpenProject selective import respects the Dates, Custom Fields and People selections', async ({ loggedInPage: page }) => {
const boardIds = [];
const doc = { _embedded: { elements: [{
id: 1, subject: 'Scheduling choice', dueDate: '2028-03-04', derivedStartDate: '2028-02-29',
_links: { assignee: { href: '/api/v3/users/11', title: 'Source assignee' },
responsible: { href: '/api/v3/users/12', title: 'Source responsible' },
author: { href: '/api/v3/users/13', title: 'Source author' } },
duration: 'P2D', derivedEstimatedTime: 'PT2H', readonly: false,
}] } };
try {
for (const field of ['dates', 'custom-fields']) {
for (const field of ['dates', 'custom-fields', 'people']) {
const boardId = await page.evaluate(({ doc, field }) => Meteor.callAsync('importBoard', doc,
{ importFields: [field], membersMode: 'me' }, 'openproject'), { doc, field });
boardIds.push(boardId);
const card = db.findOne('cards', { boardId, title: 'Scheduling choice' });
const names = db.find('customFields', { boardIds: boardId }).map(definition => definition.name);
if (field === 'people') {
expect(card.assignees).toEqual([card.userId]);
expect(card.requestedBy).toBe('Source author');
expect(names).toEqual([]);
continue;
}
expect(card.assignees).toEqual([]);
expect(card.members).toEqual([]);
expect(card.requestedBy || '').toBe('');
if (field === 'dates') {
expect(card.dueAt).toBe('2028-03-04T00:00:00.000Z');
expect(names).toEqual([]);
@@ -75,6 +75,9 @@ test('under Arabic the ? is mirrored to the other side of the Board View menu',
const sideOf = async () => {
const btn = await viewHelp(page).boundingBox();
const menu = await page.locator('.js-toggle-board-view').first().boundingBox();
const verticalOverlap = Math.min(btn.y + btn.height, menu.y + menu.height) -
Math.max(btn.y, menu.y);
expect(verticalOverlap).toBeGreaterThan(0);
return btn.x > menu.x ? 'right' : 'left';
};
await boardIn(page, user, board, 'en');
@@ -114,12 +114,19 @@ test('Date settings cascade from global to board to member through their own con
await expect(editor.locator('.js-date-format-select')).toBeVisible();
await expect(editor.locator('.js-member-date-format-heading')).toHaveText('Member Settings: Date Format');
await expect(editor.locator('.js-member-date-format-enabled')).toHaveText('Disabled');
const checkbox = editor.locator('.js-date-format-override');
const status = editor.locator('.js-member-date-format-enabled');
const label = editor.locator('label:has(.js-member-date-format-enabled)');
const checkboxBox = await checkbox.boundingBox();
const disabledStatusBox = await status.boundingBox();
expect(checkboxBox.width).toBe(17);
expect(checkboxBox.height).toBe(17);
expect(disabledStatusBox.x).toBeGreaterThan(checkboxBox.x + checkboxBox.width);
const expectStatusAligned = async () => {
const box = await editor.locator('.js-date-format-override').boundingBox();
const text = await editor.locator('.js-member-date-format-enabled').boundingBox();
expect(box.height).toBe(16);
expect(text.x).toBeGreaterThan(box.x + box.width);
expect(Math.abs(text.y + text.height / 2 - box.y - box.height / 2)).toBeLessThan(1);
const row = await label.boundingBox();
const text = await status.boundingBox();
expect(Math.abs(text.x - disabledStatusBox.x)).toBeLessThan(1);
expect(Math.abs(text.y + text.height / 2 - row.y - row.height / 2)).toBeLessThan(1);
};
await expectStatusAligned();
@@ -42,7 +42,9 @@ test('Jira Cloud imports additional list paragraphs and code inside one list ite
{ type: 'text', text: ' the runbook', marks: [link] },
] },
{ type: 'codeBlock', attrs: { language: 'js' }, content: [{ type: 'text', text: 'const ready = true;' }] },
] }] }, { type: 'expand', attrs: { title: 'Deployment notes' }, content: [
] }] }, { type: 'panel', attrs: { panelType: 'warning' }, content: [
{ type: 'paragraph', content: [{ type: 'text', text: 'Read before deploying', marks: [{ type: 'strong' }] }] },
] }, { type: 'expand', attrs: { title: 'Deployment notes' }, content: [
{ type: 'paragraph', content: [{ type: 'text', text: 'Verify the rollout', marks: [{ type: 'strong' }] }] },
] }, { type: 'table', content: [
{ type: 'tableRow', content: [{ type: 'tableHeader', content: [
@@ -60,6 +62,7 @@ test('Jira Cloud imports additional list paragraphs and code inside one list ite
try {
const board = db.findOne('boards', { _id: boardId });
const card = db.findOne('cards', { boardId });
expect(card.description).toContain('<div data-jira-panel="warning">');
expect(card.description).toContain('<time datetime="2023-07-26T04:14:39.000Z">2023-07-26</time>');
await navigateInApp(page, `/b/${boardId}/${board.slug}/${card._id}`);
const cp = new CardPage(page);
@@ -81,6 +84,9 @@ test('Jira Cloud imports additional list paragraphs and code inside one list ite
const runbook = item.getByRole('link', { name: 'Open the runbook' });
await expect(runbook).toHaveAttribute('title', 'Review "today" & deploy');
await expect(runbook.locator('strong')).toHaveText('Open');
const panel = cp.root.locator('[data-jira-panel="warning"]');
await expect(panel.locator('strong')).toHaveText('Read before deploying');
await expect(panel).toHaveCSS('border-inline-start-width', '3px');
const details = cp.root.locator('details').filter({ hasText: 'Deployment notes' });
await expect(details.locator('strong')).toBeHidden();
await details.locator('summary').click();
@@ -244,7 +250,7 @@ test('a Jira Server issue brings its affected versions, votes, web links and wor
test('Jira Cloud and Data Center underline renders on imported cards', async ({ loggedInPage: page }) => {
const source = { issues: [
{ key: 'DC-1', fields: { summary: 'Data Center underline', description: 'Read +the incident+. See ??Project handbook??.\\\\Continue here.\n\n{noformat}\n *literal log*\n{noformat}' } },
{ key: 'DC-1', fields: { summary: 'Data Center underline', description: 'Read +the incident+. See ??Project handbook??.\\\\Continue here.\n\n{noformat:title=Run log|borderStyle=dashed|bgColor=#FFFFCE}\n *literal log*\n{noformat}' } },
{ key: 'CLOUD-1', fields: { summary: 'Cloud underline', description: { type: 'doc', version: 1,
content: [{ type: 'paragraph', content: [
{ type: 'text', text: 'Read ' },
@@ -284,7 +290,7 @@ test('Jira Cloud and Data Center underline renders on imported cards', async ({
const text = card.title.includes('DC-1') ? 'the incident' : 'the report';
const citation = card.title.includes('DC-1') ? ' See <cite>Project handbook</cite>.' : '';
expect(card.description).toContain(`Read <u>${text}</u>.${citation}`);
if (citation) expect(card.description).toContain('```noformat\n *literal log*');
if (citation) expect(card.description).toContain('```noformat jira-macro:title%3DRun%20log%7CborderStyle%3Ddashed%7CbgColor%3D%23FFFFCE\n *literal log*');
await navigateInApp(page, `/b/${boardId}/${board.slug}/${card._id}`);
const cp = new CardPage(page);
await cp.waitForOpen();
@@ -35,3 +35,26 @@ test('list entry rules prompt on card drop and refuse REST moves with missing fi
expect(accepted.status(), await accepted.text()).toBe(200);
expect(db.findOne('cards', { _id: card._id }).listId).toBe(to);
});
test('native board export and import preserve list entry rules with new custom field IDs', async ({ request, board, user }) => {
const headers = { Authorization: 'Bearer ' + user.token };
const oldList = db.findOne('lists', { _id: board.listIds[0] });
const field = db.uid('field');
db.insertOne('customFields', { _id: field, boardIds: [board.boardId], name: 'Waiting for', type: 'text', settings: {} });
db.updateOne('lists', { _id: oldList._id }, { $set: { entryRequirements: ['dueAt', 'custom:' + field] } });
const exported = await request.get('/api/boards/' + board.boardId + '/export', { headers });
expect(exported.status()).toBe(200);
const document = await exported.json();
expect(document.lists.find(list => list._id === oldList._id).entryRequirements).toEqual(['dueAt', 'custom:' + field]);
const imported = await request.post('/api/boards/import', { headers, data: { board: document } });
expect(imported.status(), await imported.text()).toBe(200);
const { _id: boardId } = await imported.json();
try {
const newField = db.findOne('customFields', { boardIds: boardId, name: 'Waiting for' });
expect(newField._id).not.toBe(field);
const list = db.findOne('lists', { boardId, title: oldList.title });
expect(list.entryRequirements).toEqual(['dueAt', 'custom:' + newField._id]);
} finally {
db.cleanup({ boardIds: [boardId] });
}
});
@@ -13,7 +13,11 @@ test('a list refusing a role write refuses its checklist REST writes (ListLockBl
const locked = card(lockedListId), open = card(openListId);
const api = (method, url, data) => request[method](url, {
headers: { Authorization: `Bearer ${user2.token}`, 'Content-Type': 'application/json' }, ...(data ? { data } : {}) });
const recorded = () => db.findOne('eventlog', { bleed: 'ListLockBleed' })?.count || 0;
const username = db.findOne('users', { _id: user2.id }).username;
const recorded = source => db.find('eventlog', { stream: 'security', bleed: 'ListLockBleed', source })
.flatMap(row => Object.values(row.actors || {}))
.filter(actor => actor.kind === 'user' && actor.value === username)
.reduce((count, actor) => count + actor.count, 0);
db.updateOne('boards', { _id: board.boardId }, { $set: { members: [...original.filter(m => m.userId !== user2.id),
{ userId: user2.id, isActive: true, isAdmin: false }] } });
db.updateOne('lists', { _id: lockedListId }, { $set: { roleExceptions: { normal: { write: false } } } });
@@ -22,7 +26,8 @@ test('a list refusing a role write refuses its checklist REST writes (ListLockBl
db.insertOne('checklists', checklist);
db.insertOne('checklistItems', item);
try {
const before = recorded();
const sources = ['rest:checklist', 'rest:checklist-item'];
const before = sources.map(recorded);
const base = `/api/boards/${board.boardId}/cards/${locked._id}/checklists`;
for (const [method, url, data] of [
['post', base, { title: 'x' }],
@@ -37,7 +42,8 @@ test('a list refusing a role write refuses its checklist REST writes (ListLockBl
}
expect(db.find('checklists', { cardId: locked._id })).toEqual([expect.objectContaining({ _id: checklist._id, title: 'Locked' })]);
expect(db.find('checklistItems', { cardId: locked._id })).toEqual([expect.objectContaining({ _id: item._id, title: 'Locked item', isFinished: false })]);
expect(recorded()).toBeGreaterThan(before);
// The audit rows are folded asynchronously and grouped by route family.
await expect.poll(() => sources.map((source, index) => recorded(source) - before[index])).toEqual([3, 3]);
expect(db.findOne('users', { _id: user2.id }).loginDisabled || false).toBe(false);
// Negative: the same member writes the checklists of a list without the refusal.
+125 -24
View File
@@ -346,17 +346,34 @@ test.beforeAll(async () => {
}));
return;
}
if (url.pathname === '/api/v3/work_packages/41/form' && req.method === 'POST') {
if (url.pathname === '/api/v3/projects/10/budgets' && req.method === 'GET') {
res.writeHead(200, { 'Content-Type': 'application/json' }).end(JSON.stringify({
_embedded: { schema: {
status: { writable: true, _links: { allowedValues: [{ href: '/api/v3/statuses/6', title: 'Done' }] } },
priority: { writable: true, _embedded: { allowedValues: [
{ name: 'High', _links: { self: { href: '/api/v3/priorities/7' } } },
] } },
} },
_type: 'Collection', total: 1, count: 1, _embedded: { elements: [
{ _type: 'Budget', id: 12, subject: 'Operations', _links: { self: { href: '/api/v3/budgets/12' } } },
] },
}));
return;
}
if (url.pathname === '/api/v3/work_packages/41/form' && req.method === 'POST') {
let raw = '';
req.on('data', chunk => { raw += chunk; });
req.on('end', () => {
const payload = JSON.parse(raw);
res.writeHead(200, { 'Content-Type': 'application/json' }).end(JSON.stringify({
_type: 'Form',
_embedded: { payload, validationErrors: {}, schema: {
dueDate: { type: 'Date' },
budget: { writable: true, _links: { allowedValues: { href: '/api/v3/projects/10/budgets' } } },
type: { writable: true, _links: { allowedValues: [{ href: '/api/v3/types/9', title: 'Bug' }] } },
status: { writable: true, _links: { allowedValues: [{ href: '/api/v3/statuses/6', title: 'Done' }] } },
priority: { writable: true, _embedded: { allowedValues: [
{ name: 'High', _links: { self: { href: '/api/v3/priorities/7' } } },
] } },
} },
}));
});
return;
}
if (url.pathname === '/api/v3/work_packages/41' && req.method === 'PATCH') {
let raw = '';
req.on('data', chunk => { raw += chunk; });
@@ -369,6 +386,9 @@ test.beforeAll(async () => {
}
if (body.lockVersion !== writablePackage.lockVersion) return res.writeHead(409).end();
if (body.subject !== undefined) writablePackage.subject = body.subject;
if (body._links?.budget) writablePackage._links.budget = body._links.budget.href === null
? { href: null } : { ...body._links.budget, title: 'Operations' };
if (body._links?.type) writablePackage._links.type = { ...body._links.type, title: 'Bug' };
if (body._links?.status) writablePackage._links.status = { ...body._links.status, title: 'Done' };
if (body._links?.priority) writablePackage._links.priority = { ...body._links.priority, title: 'High' };
if (body.description !== undefined) writablePackage.description = body.description;
@@ -474,6 +494,13 @@ test.beforeAll(async () => {
return;
}
}
if (url.pathname === '/rest/api/2/issue/901/editmeta') {
if (writableJiraIssue?.denyStartDateEditMetadata) return res.writeHead(404).end();
res.writeHead(200, { 'Content-Type': 'application/json' }).end(JSON.stringify({
fields: { customfield_105: { schema: { type: 'date' }, operations: ['set'], required: false } },
}));
return;
}
if (url.pathname === '/rest/api/2/issue/901') {
if (req.method === 'GET') {
if (changeJiraBeforeWrite) writableJiraIssue.fields.summary = 'New Jira title';
@@ -593,6 +620,7 @@ test.beforeAll(async () => {
}
if (url.pathname === '/rest/api/2/field') {
res.writeHead(200, { 'Content-Type': 'application/json' }).end(JSON.stringify([
{ id: 'customfield_105', name: 'Start date', schema: { type: 'date' } },
{ id: 'customfield_44', schema: { custom: 'com.pyxis.greenhopper.jira:gh-sprint' } },
]));
return;
@@ -1344,18 +1372,26 @@ test('Jira List Sync writes titles, descriptions, due dates and estimates after
db.updateOne('cards', { _id: card._id }, { $set: { description: '', customFields: [] } });
expect(await call(page, 'syncListNow', listId)).toMatchObject({ updated: expect.any(Number) });
expect(jiraWrites[1].body).toEqual({ fields: { description: null, customfield_100: null } });
const panel = '{panel:title=Review|borderStyle=solid}\nOriginal note\n\n{code:js|title=Example}\nconst ready = true;\n{code}\n{panel}';
writableJiraIssue.fields.description = panel;
expect(await call(page, 'syncListNow', listId)).toMatchObject({ updated: 1 });
const panelCard = db.findOne('cards', { _id: card._id });
expect(panelCard.description).toContain('<!-- jira-panel:');
db.updateOne('cards', { _id: card._id }, { $set: { description: panelCard.description.replace('Original note', '**Edited** note') } });
await call(page, 'syncListNow', listId);
expect(jiraWrites[2].body).toEqual({ fields: { description: panel.replace('Original note', '*Edited* note') } });
writableJiraIssue.fields.description = '{include:original}';
expect(await call(page, 'syncListNow', listId)).toMatchObject({ updated: 1 });
db.updateOne('cards', { _id: card._id }, { $set: { description: 'Replacement' } });
await call(page, 'syncListNow', listId);
expect(jiraWrites).toHaveLength(2);
expect(jiraWrites).toHaveLength(3);
expect(writableJiraIssue.fields.description).toBe('{include:original}');
expect(db.findOne('lists', { _id: listId }).syncWriteBackError).toContain('does not support this formatting');
db.updateOne('cards', { _id: card._id }, { $set: { description: '{include:original}' } });
db.updateOne('cards', { _id: card._id }, { $set: { title: 'Second local edit' } });
changeJiraBeforeWrite = true;
expect(await call(page, 'syncListNow', listId)).toMatchObject({ conflicts: [expect.objectContaining({ field: 'title' })] });
expect(jiraWrites).toHaveLength(2);
expect(jiraWrites).toHaveLength(3);
expect(writableJiraIssue.fields.summary).toBe('New Jira title');
changeJiraBeforeWrite = false;
writableJiraIssue.fields.customfield_100 = 8;
@@ -1363,7 +1399,7 @@ test('Jira List Sync writes titles, descriptions, due dates and estimates after
customFields: [{ _id: fieldId, value: 2 }] } });
const conflict = await call(page, 'syncListNow', listId);
expect(conflict.conflicts).toContainEqual(expect.objectContaining({ field: 'estimate', local: 2, incoming: 8 }));
expect(jiraWrites).toHaveLength(2);
expect(jiraWrites).toHaveLength(3);
} finally {
db.deleteOne('customFields', { _id: fieldId });
changeJiraBeforeWrite = false;
@@ -1371,6 +1407,54 @@ test('Jira List Sync writes titles, descriptions, due dates and estimates after
}
});
test('Jira List Sync syncs the selected Start date and distinguishes missing from cleared', async ({ page, user, board }) => {
const listId = board.listIds[0];
writableJiraIssue = { id: '901', key: 'JIRAWB-1', fields: { summary: 'Scheduled issue', customfield_105: '2028-02-29' } };
jiraWrites = [];
changeJiraBeforeWrite = false;
const card = () => db.findOne('cards', { listId, syncExternalId: 'JIRAWB-1' });
try {
await loginWithToken(page, user.id, user.token);
await openBoard(page, board.boardId, board.slug);
await call(page, 'setListSyncSource', listId, {
type: 'jira', url: base, projectKey: 'JIRAWB', token: 'fixture', fields: ['title', 'startDate'], writeBack: true,
});
await openSync(page, listId);
await expect(page.locator('[data-field="startDate"] .materialCheckBox')).toHaveClass(/is-checked/);
expect(await call(page, 'syncListNow', listId)).toMatchObject({ created: 1 });
expect(card().startAt).toBe('2028-02-29T00:00:00.000Z');
expect(card().syncLastSource.startDateMapping).toBe('customfield_105');
db.updateOne('cards', { _id: card()._id }, { $set: { startAt: new Date('2028-03-04T12:00:00Z') } });
await call(page, 'syncListNow', listId);
expect(jiraWrites[0].body).toEqual({ fields: { customfield_105: '2028-03-04' } });
expect(card().syncLastSource.startDate).toBe('2028-03-04');
await call(page, 'syncListNow', listId);
expect(jiraWrites).toHaveLength(1);
delete writableJiraIssue.fields.customfield_105;
await call(page, 'syncListNow', listId);
expect(card().startAt.slice(0, 10)).toBe('2028-03-04');
expect(jiraWrites).toHaveLength(1);
writableJiraIssue.fields.customfield_105 = '2028-03-04';
db.updateOne('cards', { _id: card()._id }, { $unset: { startAt: '' } });
await call(page, 'syncListNow', listId);
expect(jiraWrites[1].body).toEqual({ fields: { customfield_105: null } });
expect(card().startAt ?? null).toBeNull();
writableJiraIssue.denyStartDateEditMetadata = true;
db.updateOne('cards', { _id: card()._id }, { $set: { title: 'Updated schedule', startAt: new Date('2028-03-05T00:00:00Z') } });
await call(page, 'syncListNow', listId);
expect(jiraWrites[2].body).toEqual({ fields: { summary: 'Updated schedule' } });
expect(writableJiraIssue.fields.customfield_105).toBeNull();
expect(db.findOne('lists', { _id: listId }).syncWriteBackError).toContain('Jira did not allow 1 Start date edit');
delete writableJiraIssue.denyStartDateEditMetadata;
await call(page, 'syncListNow', listId);
expect(jiraWrites[3].body).toEqual({ fields: { customfield_105: '2028-03-05' } });
expect(db.findOne('lists', { _id: listId }).syncWriteBackError).toBeFalsy();
} finally {
writableJiraIssue = undefined;
db.deleteMany('listSyncCredentials', { listId });
}
});
test('Jira List Sync writes only the selected mapped time estimate', async ({ page, user, board }) => {
const listId = db.findOne('lists', { boardId: board.boardId })._id;
const fieldId = `${listId}-original-time`;
@@ -1824,7 +1908,7 @@ test('OpenProject List Sync mirrors milestone type, scheduling and read-only sta
await loginWithToken(page, user.id, user.token);
await openBoard(page, board.boardId, board.slug);
await call(page, 'setListSyncSource', listId, { type: 'openproject', url: base, projectKey: 'dates', token: 'fixture',
fields: ['title', 'scheduleManually', 'ignoreNonWorkingDays', 'openProjectMilestone', 'readonly', 'displayId', 'createdAt', 'hasProjectAttributes', 'budget', 'projectPhaseDefinition', 'project', 'type', 'status'] });
fields: ['title', 'startDate', 'dueDate', 'scheduleManually', 'ignoreNonWorkingDays', 'openProjectMilestone', 'readonly', 'displayId', 'createdAt', 'hasProjectAttributes', 'budget', 'projectPhaseDefinition', 'project', 'type', 'status'] });
await openSync(page, listId);
await expect(page.locator('[data-field="scheduleManually"] .materialCheckBox')).toHaveClass(/is-checked/);
await expect(page.locator('[data-field="displayId"] .materialCheckBox')).toHaveClass(/is-checked/);
@@ -1864,7 +1948,7 @@ test('OpenProject List Sync mirrors milestone type, scheduling and read-only sta
expect(card().customFields).toContainEqual({ _id: attributes, value: true });
expect(card().syncLastSource.createdAt).toBe(sourceCreatedAt);
const localCreatedAt = card().createdAt;
openProjectScheduleFlags = { hasProjectAttributes: false, displayId: 'MOVED-17', scheduleManually: false, dueDate: null, readonly: false };
openProjectScheduleFlags = { hasProjectAttributes: false, displayId: 'MOVED-17', scheduleManually: false, startDate: '2028-03-02', dueDate: null, readonly: false };
expect(await call(page, 'syncListNow', listId)).toMatchObject({ updated: 1 });
expect(card().customFields).toEqual(expect.arrayContaining([{ _id: manual, value: false }, { _id: days, value: false }, { _id: milestone, value: false }, { _id: readonly, value: false }, { _id: identifier, value: 'MOVED-17' }]));
expect(card().syncLastSource).toMatchObject({ scheduleManually: false, ignoreNonWorkingDays: false, openProjectMilestone: false, readonly: false, displayId: 'MOVED-17' });
@@ -1879,6 +1963,15 @@ test('OpenProject List Sync mirrors milestone type, scheduling and read-only sta
expect(card().customFields).toContainEqual({ _id: workPackageType, value: 'Bug' });
expect(card().customFields).toContainEqual({ _id: workPackageStatus, value: 'Done' });
expect(card().listId).toBe(listId);
expect(card().startAt).toBe('2028-03-02T00:00:00.000Z');
delete openProjectScheduleFlags.startDate;
delete openProjectScheduleFlags.dueDate;
openProjectScheduleFlags.date = '2028-03-04';
expect(await call(page, 'syncListNow', listId)).toMatchObject({ updated: 1 });
expect(card().startAt ?? null).toBeNull();
expect(card().dueAt).toBe('2028-03-04T00:00:00.000Z');
expect(card().syncLastSource).toMatchObject({ startDate: '', dueDate: '2028-03-04', openProjectMilestone: true });
openProjectWorkspace = null;
const clearing = (await call(page, 'previewListSync', listId)).preview.coverage.source.rows;
expect(clearing).toContainEqual(expect.objectContaining({
@@ -3012,7 +3105,7 @@ test('switching projects isolates overlapping IDs, archives and credentials thro
await expect.poll(() => db.find('cards', { listId, syncExternalId: 'SAME-1' }).length).toBe(2);
expect(db.findOne('cards', { _id: first._id }).title).toBe(first.title);
expect(db.findOne('cards', { _id: first._id }).archived).toBe(false);
expect(requests.at(-1).auth).toBe(`Basic ${Buffer.from(':two-test-token').toString('base64')}`);
expect(requests.at(-1).auth).toBe('Bearer two-test-token');
emptyProjects.add('TWO');
expect(await call(page, 'syncListNow', listId)).toMatchObject({ created: 0, archived: 1 });
expect(db.findOne('cards', { _id: first._id }).archived).toBe(false);
@@ -3058,7 +3151,7 @@ test('only the committed credential version is used and clearing cannot adopt an
db.insertOne('listSyncCredentials', { _id: `staged-${listId}`, configurationId: `staged-${listId}`,
listId, sourceKey: syncSourceKey(config), token: 'unfinished-test-token' });
expect(await call(page, 'syncListNow', listId)).toMatchObject({ created: 1 });
expect(requests.at(-1).auth).toBe(`Basic ${Buffer.from(':committed-test-token').toString('base64')}`);
expect(requests.at(-1).auth).toBe('Bearer committed-test-token');
await call(page, 'setListSyncSource', listId, null);
expect(await call(page, 'hasListSyncCredential', listId)).toBe(false);
expect(db.findOne('listSyncCredentials', { _id: saved.syncRevision })).toBeNull();
@@ -3185,7 +3278,7 @@ test('credential cleanup keeps the selected token usable and later settings save
expect(db.findOne('lists', { _id: listId }).syncRevision).toBe(selected.syncRevision);
expect(await call(page, 'hasListSyncCredential', listId)).toBe(true);
expect(await call(page, 'syncListNow', listId)).toMatchObject({ created: 1 });
expect(requests.at(-1).auth).toBe(`Basic ${Buffer.from(':cleanup-selected-token').toString('base64')}`);
expect(requests.at(-1).auth).toBe('Bearer cleanup-selected-token');
await call(page, 'setListSyncSource', listId, { ...config, token: null });
const saved = db.findOne('lists', { _id: listId });
expect(db.findOne('listSyncCredentials', { _id: saved.syncRevision }).generation).toBe(1);
@@ -3466,14 +3559,18 @@ test('OpenProject catalog Sync keeps same-named source releases separate', async
});
test('OpenProject List Sync writes only allowed work package status and priority values', async ({ page, user, board }) => {
test('OpenProject List Sync writes only allowed work package status, priority, type and budget values', async ({ page, user, board }) => {
const listId = board.listIds[0];
const budgetId = db.uid('op-writable-budget');
const typeId = db.uid('op-writable-type');
const fieldId = db.uid('op-writable-status');
const priorityId = db.uid('op-writable-priority');
db.insertOne('customFields', { _id: budgetId, boardIds: [board.boardId], type: 'text', name: 'OpenProject budget name' });
db.insertOne('customFields', { _id: typeId, boardIds: [board.boardId], type: 'text', name: 'OpenProject work package type' });
db.insertOne('customFields', { _id: priorityId, boardIds: [board.boardId], type: 'text', name: 'OpenProject work package priority' });
db.insertOne('customFields', { _id: fieldId, boardIds: [board.boardId], type: 'text', name: 'OpenProject work package status' });
writablePackage = { id: 41, subject: 'Status change', lockVersion: 7,
_links: { status: { href: '/api/v3/statuses/4', title: 'In progress' }, priority: { href: '/api/v3/priorities/5', title: 'Normal' } } };
_links: { project: { href: '/api/v3/projects/10' }, budget: { href: null }, type: { href: '/api/v3/types/3', title: 'Feature' }, status: { href: '/api/v3/statuses/4', title: 'In progress' }, priority: { href: '/api/v3/priorities/5', title: 'Normal' } } };
openProjectWrites = [];
raceOpenProject = false;
try {
@@ -3481,12 +3578,12 @@ test('OpenProject List Sync writes only allowed work package status and priority
await openBoard(page, board.boardId, board.slug);
await call(page, 'setListSyncSource', listId, {
type: 'openproject', url: base, projectKey: 'writeback', token: 'fixture',
fields: ['title', 'status', 'priority'], writeBack: true,
fields: ['title', 'status', 'priority', 'type', 'budget'], writeBack: true,
});
expect(await call(page, 'syncListNow', listId)).toMatchObject({ created: 1 });
const card = () => db.findOne('cards', { listId, syncExternalId: '41' });
const edit = (value, priority = 'Normal') => db.updateOne('cards', { _id: card()._id }, {
$set: { customFields: [{ _id: fieldId, value }, { _id: priorityId, value: priority }] },
const edit = (value, priority = 'Normal', type = 'Feature', budget = null) => db.updateOne('cards', { _id: card()._id }, {
$set: { customFields: [{ _id: fieldId, value }, { _id: priorityId, value: priority }, { _id: typeId, value: type }, ...(budget ? [{ _id: budgetId, value: budget }] : [])] },
});
edit('Unavailable');
db.updateOne('cards', { _id: card()._id }, { $set: { title: 'Edited title' } });
@@ -3495,15 +3592,19 @@ test('OpenProject List Sync writes only allowed work package status and priority
expect(openProjectWrites[0].body).toEqual({ lockVersion: 7, subject: 'Edited title' });
expect(writablePackage._links.status.title).toBe('In progress');
expect(db.findOne('lists', { _id: listId }).syncWriteBackError).toContain('unique allowed transition');
edit('Done', 'High');
edit('Done', 'High', 'Bug', 'Operations');
await call(page, 'syncListNow', listId);
expect(openProjectWrites).toHaveLength(2);
expect(openProjectWrites[1].body).toEqual({ lockVersion: 8, _links: { status: { href: '/api/v3/statuses/6' }, priority: { href: '/api/v3/priorities/7' } } });
expect(card().syncLastSource).toMatchObject({ status: 'Done', priority: 'High' });
expect(openProjectWrites[1].body).toEqual({ lockVersion: 8, _links: { budget: { href: '/api/v3/budgets/12' }, type: { href: '/api/v3/types/9' }, status: { href: '/api/v3/statuses/6' }, priority: { href: '/api/v3/priorities/7' } } });
expect(card().syncLastSource).toMatchObject({ status: 'Done', priority: 'High', type: 'Bug', budget: 'Operations' });
await call(page, 'syncListNow', listId);
expect(openProjectWrites).toHaveLength(2);
edit('Done', 'High', 'Bug');
await call(page, 'syncListNow', listId);
expect(openProjectWrites[2].body).toEqual({ lockVersion: 9, _links: { budget: { href: null } } });
expect(card().syncLastSource.budget).toBeNull();
} finally {
db.deleteMany('customFields', { _id: { $in: [fieldId, priorityId] } });
db.deleteMany('customFields', { _id: { $in: [fieldId, priorityId, typeId, budgetId] } });
db.deleteMany('listSyncCredentials', { listId });
}
});
@@ -25,8 +25,10 @@ test('the Definition of Ready is saved with the Scrum settings and shown to the
await call(page, 'scrum.configure', board.boardId, { definitionOfReady: 'Estimated, small, with acceptance criteria' }, null);
await expect.poll(() => (db.findOne('boards', { _id: board.boardId }).scrum || {}).definitionOfReady, { timeout: 15_000 })
.toBe('Estimated, small, with acceptance criteria');
// The Scrum view reads its data when it opens (the admin's Save refreshes it).
await openBoard(page, board.boardId, board.slug);
// Reopen the backlog through the view menu so it fetches fresh Scrum data.
await page.locator('.js-toggle-board-view').first().click();
await page.locator('.pop-over .js-open-swimlanes-view').click();
await expect(page.locator('.js-list:not(.js-list-composer)').first()).toBeVisible();
await view(page, 'product-backlog');
const block = page.locator('.js-scrum-definition-of-ready');
await expect(block).toBeVisible({ timeout: 15_000 });
@@ -350,13 +350,19 @@ test('scoped Jira and OpenProject JSON import places cards and their relations b
expect(assignedCard.members).toEqual([user2.id]);
expect(assignedCard.watchers).toEqual([]);
expect(time(assignedCard._id)).toContainEqual(expect.objectContaining({ hours: 0.5, userId: user2.id, note: 'Mapped time' }));
const opTime = { _embedded: { elements: [{ id: 6, subject: 'OpenProject mapped time', _embedded: {
const opTime = { _embedded: { elements: [{ id: 6, subject: 'OpenProject mapped time',
_links: { assignee: { title: 'OP logger', href: '/api/v3/users/11' },
responsible: { title: 'OP responsible', href: '/api/v3/users/12' } },
_embedded: {
timeEntries: [{ hours: 'PT1H', spentOn: '2028-03-05', _links: { user: { title: 'OP logger' } } }],
} }] } };
expect(await page.evaluate(({ scope, opTime, userId }) => Meteor.callAsync('importScoped', scope, opTime,
['people', 'dates'], null, { mapping: [{ source: 'OP logger', userId }] }),
['people', 'dates'], null, { mapping: [{ source: 'OP logger', userId }, { source: 'OP responsible', userId: Meteor.userId() }] }),
{ scope, opTime, userId: user2.id })).toMatchObject({ cards: 1 });
expect(time(card('OpenProject mapped time')._id)).toContainEqual(expect.objectContaining({ hours: 1, userId: user2.id }));
const opCard = card('OpenProject mapped time');
expect(opCard.assignees).toEqual([user2.id]);
expect(opCard.members).toEqual(expect.arrayContaining([user2.id, jira.userId]));
expect(time(opCard._id)).toContainEqual(expect.objectContaining({ hours: 1, userId: user2.id }));
const deck = { title: 'Deck board', stacks: [{ title: 'Deck stack', cards: [{
title: 'Scoped Deck card', description: 'Deck notes', duedate: '2028-03-05T12:00:00Z',
done: '2028-03-06T12:00:00Z', labels: [{ title: 'Deck label', color: '0082c9' }],
+2
View File
@@ -66,6 +66,8 @@ test('build.sh: the menu entry, its case arm and the server it starts', () => {
'WRITABLE_PATH="$writable"', 'mongo_answers "$port"', '/meteor"']) {
assert.ok(server.includes(needle), needle);
}
assert.ok(server.indexOf('export WEKAN_TEST_SMTP_PORT=') > server.indexOf('build_wekan'));
assert.ok(server.includes('MAIL_URL="smtp://127.0.0.1:$WEKAN_TEST_SMTP_PORT"'));
const runner = fn('run_playwright_spec');
assert.match(runner, /start_spec_test_server[\s\S]*stop_spec_test_server/, 'what it starts, it stops');
assert.match(runner, /run_playwright_docker "\$b"[\s\S]*"\$\{args\[@\]\}"/, 'the spec reaches the container too');
+14
View File
@@ -224,6 +224,20 @@ print(json.dumps({'authenticated': True}))
self.assertFalse((self.output / 'component/migration/Dockerfile').exists())
self.assertEqual(ucs.images(compose, {'wekan': 'ghcr.io/wekan/wekan:v12.28', 'wekandb': DATABASE_IMAGE}), compose)
def test_prepare_preserves_an_already_converted_migration_worker(self):
source = self.root / 'source'
hook_path = source / 'component/preinst'
hook = hook_path.read_text()
worker = ' /usr/local/bin/node /opt/ucs-migration/start.mjs'
check = 'docker run --rm --entrypoint /usr/local/bin/node "$image" /opt/ucs-migration/start.mjs --check'
hook = hook.replace('docker pull "$helper"\n', 'docker pull "$helper"\n' + check + '\n')
hook_path.write_text(hook.replace(':/data" "$helper"\n', ':/data" "$helper"' + worker + '\n'))
ucs.prepare(source, self.output, '13.39')
prepared = (self.output / 'component/preinst').read_text()
self.assertEqual(prepared.count(check), 1)
self.assertEqual(prepared.count('"$helper"' + worker), 1)
self.assertNotIn(worker + worker, prepared)
def test_database_tag_override_updates_compose_and_hook(self):
selected = 'ghcr.io/wekan/ferretdb:v1.93.0'
result = ucs.prepare(self.root / 'source', self.output, '12.28', selected)
+14
View File
@@ -130,6 +130,20 @@ async function main() {
});
const records = await import('../models/lib/wekanRecordFields.js');
test('native imports omit Notion and Planka synchronization bookkeeping', () => {
assert.deepEqual(cardFields.wekanCardFields({ notionSyncedMemberIds: ['source-member'] }), {});
const now = new Date('2026-12-02T00:00:00Z');
assert.deepEqual(records.wekanRecordFields('checklists', {
resetInterval: 'weekly', plankaRemoteId: 'remote-checklist', plankaSyncSort: 1,
}, { now }), { resetInterval: 'weekly', lastResetAt: now });
assert.deepEqual(records.wekanRecordFields('checklistItems', {
plankaRemoteId: 'remote-item', plankaSyncFinished: true,
}), {});
assert.deepEqual(records.wekanRecordFields('cardComments', {
plankaSentCommentId: 'remote-comment', plankaCommentSentBaseline: { text: 'Old' },
}), {});
});
test('every field of a list, swimlane, checklist, item, custom field and comment is imported, or named', () => {
const files = { lists: 'models/lists.js', swimlanes: 'models/swimlanes.js', checklists: 'models/checklists.js',
checklistItems: 'models/checklistItems.js', customFields: 'models/customFields.js', cardComments: 'models/cardComments.js' };