Commit Graph
89 Commits
Author SHA1 Message Date
Lauri Ojansivu c37575f1fa Checklists have a partial index on resetInterval for the recurring-reset cron.
The recurring-checklist reset cron queries
resetInterval: { $exists: true, $nin: [null, 'none'] } on every tick, and with
no index that read the whole checklists collection (about 45,000 documents on
the reporting instance), reported as db.collection-scan on Admin Panel ->
Problems. A partial index on resetInterval, like the one #6825 added for
recurring cards, holds only the recurring checklists.

Thanks to Raymond-Voogt and xet7 !

Fixes #6899.
2026-11-13 17:45:05 +02:00
Lauri Ojansivu 70202a849b Add checklist deadlines and expose checklist item dates in REST
Add optional checklist dueAt with the shared selected-calendar picker and badge. Return checklist and item deadlines from checklist and single-card GETs. Accept validated timezone-qualified ISO deadlines in checklist/item POST and PUT; null clears, omission preserves. Keep existing write permissions and ownership checks. Node regression and Chromium save/clear test pass.

Thanks to rmb82 and xet7 !

Fixes #6693,
2026-09-15 00:54:45 +03:00
Lauri Ojansivu 6d43020212 Add "Check all items" / "Uncheck all items" to the checklist action menu.
The checklist's own action popup (checklistActionsPopup) had reset,
hide-checked, hide-all and export/edit-as-text actions but no way to bulk
check or uncheck every item at once - #4218's "Edit as text" only offers an
indirect workaround (replace every "[ ]"/"[x]" by hand). Checklists.
checkAllItems()/uncheckAllItems() already existed as model helpers used by
the Rules automation (server/rulesHelper.js), so this wires the same two
methods to new menu entries, and extracts the item-selection logic they
share into a pure, unit-testable helper (models/lib/checklistBulkCheck.js).

Thanks to justinr1234 and xet7 !

Closes #2473,
2026-09-10 20:40:17 +03:00
Lauri Ojansivu 73128dd7fc Add a per-checklist automatic-reset schedule (daily/weekly/monthly).
A checklist can now be set to automatically uncheck all of its items on a
recurring schedule via Checklists.resetInterval ('none' by default, or
'daily'/'weekly'/'monthly') and Checklists.lastResetAt. The due-date
arithmetic is a pure, unit-tested module
(models/lib/checklistResetSchedule.js), and the periodic scan
(server/checklistResetSchedule.js) reuses the existing quave:synced-cron
infrastructure server/scheduledRules.js already registers a job on, running
hourly to uncheck items of checklists whose interval has come due.

Thanks to travelg and xet7 !

Closes #3818,
Closes #4729.
2026-09-10 20:20:35 +03:00
Lauri Ojansivu f4af25ee22 Extract the checklist-template append/copy document builders as pure functions, with tests.
models/lib/checklistTemplateCopy.js pulls the "copy a checklist/item
document onto another card" logic out of Checklists.copy() /
copyAllFromCardToCard() (#4017) into plain, Meteor-free functions -
the same split already used for subtask copying
(models/lib/subtaskCopy.js) and bulk checklist-item text editing
(models/lib/checklistItemsAsText.js) - so the copy semantics are unit
tested directly: the copy reproduces the source's checklist/item
content, drops the source _id (a fresh one is assigned on insert),
re-homes onto the destination card/board, places an appended checklist
after the target's own (existing checklists are read but never
mutated), and forces a copied item unchecked when resetChecked is set
while leaving the default (ordinary "Copy Checklist" / card copy)
behaviour unchanged. Checklists.copy() and copyAllFromCardToCard() now
call these builders instead of repeating the field-by-field copy
inline; behaviour is unchanged (the full node suite's existing
checklist tests still pass).

Thanks to Th0mas89 and xet7 !
2026-09-10 20:02:49 +03:00
Lauri Ojansivu 3f4c5e68c9 Let a checklist template's items be appended onto an existing card.
Checklists.copy() now takes an options.resetChecked flag so a copied
item can be forced unchecked regardless of its source isFinished state,
and a new Checklists.copyAllFromCardToCard(sourceCardId, targetCardId)
appends every checklist of a source (e.g. template) card onto a
destination card's existing checklists, in source order, without
touching what is already there. Both are used by the new "Copy
Checklist From Template" card action (client/components/cards/checklists.js
and .jade), which reuses the same board/swimlane/list/card picker as
Move/Copy Checklist.

Thanks to Th0mas89 and xet7 !

Closes #4017,
2026-09-10 19:55:37 +03:00
Lauri Ojansivu 569dd4af54 Index the collections a card is made of.
Reported by email against 10.91: "Still slow on loading cards. Test server with
me as only user." One user is the part that says what it is not: with nobody
else on the server there is no contention, no queue and no lock, so the time is
going into the queries themselves.

It was. cards, activities, cardComments, checklists and checklistItems - every
collection a board draws and an opened card pulls in - had NO index at all.
"The cards of this list", "the comments of this card", "the newest activities of
this board" each walked the whole collection. That is invisible on a demo board
and expensive on a real one, and worse on FerretDB, whose SQLite backend has to
walk the same documents. The activities publication even explains that it keeps
its selector flat so it can push down to FerretDB's index; there was no index
for it to push down to.

Each index matches a selector the app really makes WITH the sort it really uses
- boardId+archived, listId+sort, swimlaneId+sort, parentId, boardId+cardNumber
for cards; cardId+createdAt and boardId+createdAt for activities and comments;
cardId+sort and checklistId+sort for the checklists - because an index on the
filter alone still leaves an in-memory sort of everything it matched, which on a
board with a year of history is the slow half.

They go through the same idempotent ensureIndex every other index here uses: it
waits for the replica-set primary, does nothing when the index is already there,
and logs a backend that refuses one instead of stopping the server.

tests/cardQueryIndexes.test.cjs pins the set, and that each one carries the sort
as well as the filter.

Thanks to xet7 !
2026-08-14 13:58:44 +03:00
Lauri Ojansivu 32b61f186f Checklists: "Show on minicard" is an override, so unchecking it hides the checklist.
Reported by email with a screenshot (Swedish): "Även om jag avmarkerar 'Visa på
minikort' (och vill dölja checklistan på minikortet)" - the switch is off and the
checklist is on the minicard anyway.

It was off for everybody. The minicard asked:

  board.allowsChecklistsOnMinicard || checklist.showChecklistAtMinicard

and the board flag defaults to TRUE. An OR cannot be argued with: while the board
setting is on, no value of the checklist's own field changes the answer. The popup
made it look like a working switch - it drew the state from the raw field, which
starts false, so it read OFF beside a checklist that was plainly showing, and
clicking it wrote true and changed nothing visible. Clicking again wrote false and
changed nothing either. Dead in both directions, which is exactly what the
screenshot shows.

The two settings are a DEFAULT and an OVERRIDE, not two ways of saying yes:

  showChecklistAtMinicard === true   -> shown, whatever the board says
  showChecklistAtMinicard === false  -> hidden, whatever the board says
  showChecklistAtMinicard undefined  -> follow the board's default

An override needs three states, so the field loses `defaultValue: false`: with
every checklist born false, "hidden" and "not chosen" are the same value and the
override cannot exist. models/lib/minicardChecklistVisibility.js is the one rule,
used by the minicard, the popup's switch and the toggle - and the toggle now flips
what is ON SCREEN rather than the raw field, because flipping the field is what
made the first click do nothing.

Checklists written under the old default carry a false that meant "follow the
board". Left alone under the new reading it would mean "hide this one" and every
checklist would vanish from every minicard - the mirror image of the bug. The
schema-upgrade step checklist-minicard-unset clears exactly those, and it is the
one step there that must run ONCE EVER rather than once per version: afterwards a
stored false is somebody's choice, and re-running would put their checklists back.
It keeps its own marker beside the schema-upgrade one for that.

tests/minicardChecklistVisibility.test.cjs covers the reported case, the opposite
one, that two clicks return to the board default, and that only true and false are
opinions - a string, a number or a null from an old REST client or a bad import
must not quietly mean "hide". tests/schemaUpgradeSteps.test.cjs gains the step,
including the negative: after it has run, a false set by a person survives the next
release.

Verified by running both suites and the whole node suite (377 suites, 0 failed).
Not verified in a browser: this sandbox has none.

Thanks to xet7 !
2026-08-12 14:45:07 +03:00
Lauri OjansivuandClaude Opus 4.8 39e8cc11a4 perf(#5688): copy a card's checklists/items without per-item activity churn
Checklist.copy() duplicated each checklist item with the hooked insertAsync, so
collection-hooks fired each item's after.insert — every one doing a getCard and
inserting an addChecklistItem activity. Copying a card with ~100 items meant
~100+ activity inserts plus per-item DB round-trips, taking minutes and spiking
CPU. The copy now uses .direct for the checklist and its items (skipping the
per-item activity hooks, which are pure churn for a wholesale copy) and sets
boardId itself — the same approach as the cardRemover delete path.

Copy regression (checklist + all items duplicated, correct boardId/checklistId)
in tests/playwright/specs/17-rest-api.e2e.js. Also documents #5388 (list
collapse now per-user) as verified-resolved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 07:59:35 +03:00
Lauri OjansivuandClaude Opus 4.8 e98aae278b Fix #5408: per-checklist 'Hide checked items' toggle direction and scope
The 'Hide checked items' state is now read per checklist (from that checklist's own
hideCheckedChecklistItems field) and an item is hidden exactly when it is checked
and that checklist's toggle is on — so toggling one checklist no longer affects the
others and the direction is no longer inverted. Pure isItemHidden helper unit-tested.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 19:17:01 +03:00
Lauri Ojansivu 075e86b00e **Fixed new checklists (and checklist items) on a newly added card not being
visible until logout/login.** The `board` publication batched checklists,
checklist items, comments and attachments into board-level cursors filtered by
`cardId: { $in: cardIds }`, where `cardIds` was a one-time snapshot. In
`reywood:publish-composite` a child cursor only re-runs when its parent (the
board) document changes, so the snapshot never refreshed when a card was added
— a checklist on a card created after subscribing matched no published card and
only appeared on the next subscribe (logout/login). This was a regression from
the "Optimized board loading" change, which had replaced the original reactive
per-card child cursors with these batched snapshots. Fixed by **denormalizing a
`boardId` field onto `Checklists` and `ChecklistItems`** so they can be
published with a single board-level cursor filtered by `boardId` — one cursor
per collection (keeping the load optimization) that still reacts to checklists
on newly added cards, because a new checklist is created already carrying the
board's id. `boardId` is set on insert (server `before.insert` hooks, plus
explicitly in the Trello/WeKan board importers, which use `direct.insert` and
bypass hooks), re-derived when a checklist/item or its card moves to another
card (`before.update` on `cardId`) or the card moves to another board
(`Cards.after.update` cascade), and backfilled for existing data by an
idempotent startup migration. New `{ boardId: 1 }` indexes were added on both
collections. Comments and attachments instead remain reactive as per-card
children of the cards cursor. Assigned-only board members still only receive
checklists for cards assigned to them (the board-level cursor falls back to the
assigned cards' ids for those roles).

Thanks to ahlgrimma and Claude !

Fixes #6361
2026-06-06 04:02:48 +03:00
Harry Adel 63ce45c538 Split shared models from Meteor 3 server runtime 2026-03-24 01:50:39 +02:00
Harry Adel 2e3fbf25db Meteor 3.4 migration: Convert allow/deny callbacks to async
Meteor 3.x supports async allow/deny callbacks. Convert all 25 sync
allow/deny callbacks across 23 model files to use async/await with
findOneAsync/fetchAsync instead of sync findOne/find().fetch().

Also converts helper functions in server/lib/utils.js:
- allowIsBoardMemberWithWriteAccessByCard -> async
- allowIsBoardMemberByCard -> async
- canUpdateCard (cards.js) -> async
- permissionHelper.allow (integrations.js) -> async
2026-03-22 17:44:29 +02:00
Harry Adel b5782c7b86 Replace underscore with native JS in models
Largest changes in cards.js (~76 calls), boards.js (~38 calls),
and activities.js (~31 calls). Key patterns:

- _.contains -> .includes() with null guards where needed
- _.findWhere/_.where -> findWhere()/where() helpers
- _.pluck -> .map()
- _.union -> [...new Set()]
- _.extend -> Object.assign()
- _.each on objects -> Object.entries().forEach() (argument order swap)
- _.debounce -> debounce() helper
- _.groupBy/_.indexBy -> groupBy()/indexBy() helpers
- _.clone -> spread operator
- _.sortBy -> [...arr].sort()
- Type checks -> native typeof
2026-03-18 22:39:06 +02:00
Harry Adel e77be37450 Use sync code in allow/deny for 2.x 2026-02-19 00:26:47 +02:00
Harry Adel f934aea2a5 Return data on client (sync) and Promise on server (async) naturally, without wrapping in an extra Promise 2026-02-18 18:24:55 +02:00
Harry Adel 71eb01e233 Update ReactiveCache call sites to use async/await for Meteor 3.0
Part 3 of ReactiveCache async migration:
- Add await before all ReactiveCache.getX() calls
- Make functions containing ReactiveCache calls async
- Convert forEach/map/filter loops with async callbacks to for...of
- Update model helpers, Meteor methods, JsonRoutes handlers
- Update collection hooks (.before/.after insert/update/remove)
- Update .allow() callbacks to async

Files updated across models/ and server/ directories:
- Model files: cards, boards, lists, swimlanes, activities, users,
  checklists, checklistItems, customFields, attachments, integrations,
  cardComments, settings files, creators, exporters, and more
- Server files: publications, methods, notifications, routes, migrations
2026-02-01 00:54:38 +02:00
Lauri Ojansivu 25eedd187e Merge pull request #6093 from harryadel/createIndex-migration
Migrate createIndex to createIndexAsync
2026-01-24 02:04:35 +02:00
Harry Adel ca2083c858 Migrate createIndex to createIndexAsync 2026-01-24 01:55:29 +02:00
Harry Adel 94a3575e2c Replace mquandalle:collection-mutations with collection helpers 2026-01-21 19:22:54 +02:00
Lauri Ojansivu eabb6a239d Fix New Board Permissions: NormalAssignedOnly, CommentAssignedOnly, ReadOnly, ReadAssignedOnly. Part 1.
Thanks to nazim-oss and xet7 !

Related #6060
2026-01-14 23:43:11 +02:00
Lauri Ojansivu fbfde81bc8 Opened card Checklist menu: Hide finished tasks. Show Checklist at Minicard.
Thanks to C0rn3j and xet7 !

Fixes #6019,
fixes #5567,
fixes #2984
2025-12-29 21:42:19 +02:00
Lauri Ojansivu 5cd875813f Security Fix 7: Checklist create IDOR: cardId not verified against boardId.
Thanks to Joshua Rogers of joshua.hu, Twitter MegaManSec !
2025-12-29 16:58:26 +02:00
Lauri Ojansivu 08a6f084eb Security Fix 6: Checklist delete IDOR: checklist not verified against board/card.
Thanks to Joshua Rogers of joshua.hu, Twitter MegaManSec !
2025-12-29 16:54:04 +02:00
Martin Filser 0783b733b0 Checklist, hide all checklist items possible, regardless if the checklist item is finished or not 2024-11-15 21:00:06 +01:00
Martin Filser bb17feaa17 Checklist, hide checked checklist items (configureable at each checklist) 2024-11-15 21:00:06 +01:00
Martin Filser 8448068d22 hide empty checklist if checklist items are hidden
conditions are:
- the checklist must have at least 1 checklist item
- all checklist items have to be finished
- the option "hide checked checklist items" is set at card details
2024-11-15 20:35:18 +01:00
Martin Filser d949753d54 preparation hide checklist-items per card 2024-11-15 20:35:17 +01:00
Lauri Ojansivu 86814a0fd8 At opened card, toggle to show checklist at minicard. Part 4.
Thanks to xet7 !
2023-08-22 05:10:02 +03:00
Lauri Ojansivu 2a190fdc19 At opened card, toggle to show checklist at minicard. Part 1.
Thanks to xet7 !
2023-08-21 22:34:59 +03:00
Martin Filser 316acd0366 ReactiveMiniMongoIndex, added getChecklistItemsWithChecklistId 2023-07-18 21:25:29 +02:00
Martin Filser fef6433b75 Move every Activities.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/) 2023-07-18 21:25:29 +02:00
Martin Filser e5359dc838 Move every Checklists.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/) 2023-07-18 21:25:28 +02:00
Martin Filser 6fd3c0fa6b Move every ChecklistItems.find(idOrFirstObjectSelector, options) to the ReactiveCache (directory models/) 2023-07-18 21:25:28 +02:00
Martin Filser 5552c17eba Move every Checklists.findOne(idOrFirstObjectSelector, options) to the ReactiveCache 2023-07-18 21:25:28 +02:00
Martin Filser 3b65113d05 Move every Cards.findOne() to the ReactiveCache 2023-07-18 21:25:28 +02:00
Martin Filser a182482cfb Move every Boards.findOne(boardId) to the ReactiveCache (Part 2) 2023-07-18 21:25:28 +02:00
Martin Filser 43d11af631 Performance, improving page load about 40% faster 2023-07-18 21:25:27 +02:00
Martin Filser 13fecfae27 Copy Checklist only copied the checklist items at the first time, now always 2023-06-28 21:05:25 +02:00
Martin Filser 23595674cf Add checklist-item at top 2023-06-21 23:09:29 +02:00
Lauri Ojansivu 9de7040401 Moved new_checklist_item API to correct file where is other checklist item API.
Thanks to xet7 !
2023-05-15 23:43:42 +03:00
DimDz e9e3e14695 Update checklists.js
https://github.com/wekan/wekan/issues/4562
2023-05-02 15:08:14 +03:00
Lauri Ojansivu 8092f8be28 Try to fix User API.
Thanks to xet7 !

Fixes #4039
2023-01-13 21:50:39 +02:00
Lauri Ojansivu c926475eb1 Fixed _ensureIndex to createIndex for MongoDB 5. Updated to latest Meteor beta. 2022-04-18 18:08:12 +03:00
Martin Filser ac1f540763 Added progress bar to checklist
- Relates #1847
2022-01-18 00:16:19 +01:00
Martin Filser a66257ec21 Added "Move Checklist" to checklist menu action 2022-01-17 23:38:21 +01:00
Lauri Ojansivu e3a0dea85f Fixed REST API, it shoud work now by Admin user.
Reverted Allow board members to use more of API of Wekan v5.35
https://github.com/wekan/wekan/commit/a719e8fda1f78bcbf9af6e7b4341f8be1d141e90

Thanks to tomhughes.

Fixes #4009,
fixes #2793,
fixes #2790
2021-09-25 18:09:18 +03:00
Lauri Ojansivu a719e8fda1 Allow board members to use more of API. Please add issue (or pull request) if this allows too much.
Thanks to JayVii and xet7 !

Fixes #3862
2021-06-14 15:01:37 +03:00
Martin Filser e8b6b78dfa Checklistitems are now inserted always at the end of the checklist 2021-02-09 16:08:05 +01:00
Lauri Ojansivu 858bb35612 v4.05 2020-05-25 21:46:08 +03:00