mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
v10.40
1072
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b3537985eb |
Mark the guarded publication arguments as checked, or the audit throws.
The guard replaced `check(boardId, String)` with `Match.test(...)`, and every subscription then failed with Exception from sub board id ... Error: Did not check() all arguments during publisher 'board' This app runs with audit-argument-checks: a publisher that returns without having check()ed every one of its arguments is failed by the audit, and `Match.test` is not checking - it only asks. So the server no longer died, but no board could be subscribed to either. Each guarded publisher now marks its arguments with `check(x, Match.Any)` - which satisfies the audit and cannot throw - and validates them with `Match.test` immediately after. `board`, `boardCardsWindow` and `boardCardsLoadingMode` all do this. Checked the other publications too: `activities` was the only other one that looked unchecked, and it does check its argument, over several lines. tests/publicationArgumentGuard.test.cjs now requires both halves - every argument marked with Match.Any, and the marking before the validation - so removing the check() again fails the suite instead of the server. Thanks to xet7 ! |
||
|
|
3c5c0a16a5 |
A subscription with no board id took the server down. It is answered, not fatal.
From the dev server log:
Match error: Expected string, got null
at Subscription.<anonymous> (server/publications/boards.js:481)
SyncedCron: Fatal error encountered (unhandledRejection)
=> Exited with code: 1
`publishComposite('board')` starts with `check(boardId, String)`. A subscription
arrives with a null board id, check() throws, and a throw inside an ASYNC
publisher escapes as an unhandled promise rejection - which this app treats as
fatal and exits on. So one bad subscription stops the server for everyone, and
the arguments come from the client: any client can send it, logged in or not.
The app was in fact sending it itself, from a popup that read
`Session.get('currentBoard')` on a page that has no current board.
Both halves are fixed. The publisher TESTS its arguments instead of checking
them: a subscription that names no board publishes nothing (publishComposite
treats a falsy return as "no publications" and readies the subscription), so the
client gets an empty result and the process stays up. The same guard is on
`boardCardsWindow` and `boardCardsLoadingMode`, which are async publishers with
the same shape. And the client no longer sends a subscription for a board id it
does not have - the popup's Session read, two <select> values, a new board id
that may be undefined when the insert failed, and a template container with no
linked board.
tests/publicationArgumentGuard.test.cjs replays the guard for null, undefined,
empty string, a number and a selector object, checks the guard runs before the
publisher touches the id, and fails on an unguarded board subscription in the
client file this came from.
Thanks to xet7 !
|
||
|
|
2973240a7f |
Clicking a card closes the one that was open; keeping many open is a setting.
Opening a card APPENDED it to the open-cards list, so the card that was already open stayed open behind the new one - which the reporter saw as soon as the new card was dragged: the old one was still sitting there. Clicking another card means "show me that card", not "show me both". A click now opens THAT card and closes the previous one. Both ways of opening a card - the minicard and its title - go through one helper, so neither path can drift from the other again. Keeping several cards open at the same time is still possible, as the per-user setting it should always have been: Member Settings / "Open many cards at once", off by default, stored as `profile.openManyCardsAtOnce` and toggled by a server method like the settings beside it. A reader who is not logged in gets the default rather than an error. tests/openManyCardsAtOnce.test.cjs replays the decision in both states and guards the wiring: schema, helper, method, menu entry, check mark and translation. Thanks to mimZD and xet7 ! Fixes #6531, |
||
|
|
40de1799ae |
GHSA-3gcg-g6rf-w2rx: an invalid authToken crashed the server (remote DoS).
The board export REST endpoints look a user up by the login token in
`?authToken=`. A token that matches nothing makes that lookup answer `undefined`,
and the next line dereferenced it:
user = await ReactiveCache.getUser({ 'services.resume.loginTokens.hashedToken': … });
adminId = user._id.toString(); // TypeError on an unknown token
The handlers are async and had no try/catch, so the TypeError escaped as an
unhandled promise rejection - which this app turns into a full process crash (the
note in server/ldapGroupSync.js explains why). One crafted GET against a private
board id took the server down for every user. Reachable by anyone who can obtain a
private board id, which on an open-registration instance means anyone at all.
It was an incomplete fix: models/exportPDF.js and models/exportExcelCard.js
already had the `if (!user)` guard; three handlers in models/export.js and one in
models/exportExcel.js were missed.
Fixed on both levels:
* Every token lookup in the export models is now followed by the guard - 401
"Invalid token" and return - including the two handlers that did not crash
because they hand the user to canExport() instead of dereferencing it. One
rule for every lookup is what stops the next handler being the missed one.
* Every export route body is wrapped in safeRoute() (server/apiMiddleware.js),
which awaits the handler, answers 500 once and logs the request that failed.
A throw from any other cause is now one broken request instead of an outage.
tests/exportTokenGuard.test.cjs does not check four places by hand: it finds every
token lookup in the export models and requires a guard on each, that nothing
dereferences the user before it, that every route is wrapped, and that the two
handlers which were already guarded stay guarded.
Thanks to laijunyue for the coordinated disclosure, and xet7 !
|
||
|
|
a9fbebde00 |
Admin Panel: the Settings checkboxes could not be ticked - the fields were not published.
"Support page enabled" animated to checked and fell back to unchecked. The reason was not the checkbox: Admin Panel / Settings / Visibility draws it from `currentSetting.supportPageEnabled`, and that field was not in the `setting` publication. On the client it was therefore always undefined - the box drew unchecked, ticking it wrote the setting to the server, and the next re-render drew it unchecked again. The setting was saved; the checkbox said it was not. Announcement's checkbox never had the problem because it reads the Announcements collection, which is published whole - which is exactly why that one worked and the Settings-backed ones did not. Now published, and each of them is a control that was unusable: supportPageEnabled, supportPagePublic, supportTitle, supportPageText, supportPopupText, hideBoardActivitiesOnAllBoards (Visibility / All Boards) and boardMembersFromSameOrgOnly / boardMembersFromSameTeamOnly (People / Organizations and Teams). The SMTP settings stay out: they carry a password and have their own admin-gated publication. tests/settingPublishedFields.test.cjs walks every `currentSetting.<field>` in every client template and fails when the publication does not carry it, so the next field added to a pane cannot silently render as undefined. Thanks to xet7 ! |
||
|
|
f15d0c0cba |
Multitenancy: the three tenant modules must be ES modules.
Every app file is an ES module in Meteor, so `module.exports = {…}` in one of
them throws the moment the CLIENT bundle loads it:
Uncaught Error: ES Modules may not assign module.exports or exports.*,
Use ESM export syntax, instead: ./models/lib/tenantAdmin.js
and because it throws, every module after it in the client graph never runs -
models/users.js imports tenantAdmin, so the whole client went down with it.
models/lib/tenants.js, tenantAdmin.js and tenantBackup.js now export with ESM
syntax, and every importer uses import instead of require(). The .cjs unit tests
load them with a dynamic import(), the way tests/cardUrl.test.cjs already loads
its module.
tests/tenantWiring.test.cjs guards both halves, so the same crash cannot come
back quietly.
Thanks to xet7 !
|
||
|
|
36b899b9d6 |
Multitenancy: one WeKan server for many domains, with Organizations as tenants.
Implements option D of docs/Design/Multitenancy/Multitenancy.md, which that document now describes as shipped. An Organization may claim hostnames (Admin Panel / People / Organizations -> Edit), carry its own branding - product name, logos, help link, legal notice and theme colour - and have its own Organization admins, appointed from the row's "..." menu. The request's host picks the Organization; its branding replaces the instance branding for that request, and the client bundle that host serves points its DDP connection back at that host instead of at the one ROOT_URL. An Organization admin administers their own Organization and nothing else: its people, its Organizations row, its theme colour and its backups. They can never grant the site-wide Admin flag, never manage a site admin, and never see another Organization's people or archives. Per-tenant backup and restore is one new control in Admin Panel / Attachments / Backup - Scope. An Organization's archive holds its boards and everything on them plus the attachments those boards use, and no accounts, no instance settings and no org/team documents, because those are shared. A restore may only write to boards that Organization owns: the board ids are the intersection of what the archive claims with what the Organization really owns, every document is checked against that, and "replace all" replaces that Organization's documents rather than everyone's. Admin Panel / Settings / Visibility gains a Change color section above Logo: the site theme, rendered by the SAME shared picker as Board Settings and Member Settings - one template for all three, the way one shared table page serves every table. Its design is the new docs/Design/Page/Theme.md. The order of themes is WeKan's default theme, then the site theme (an Organization's own value on its own hosts), then a user's own override; a board's own colour still owns the board page. All of it is OFF unless the server is started with MULTITENANCY=true (plus MULTITENANCY_TRUST_PROXY_HOST=true when a trusted proxy sets X-Forwarded-Host), so an instance that has never heard of tenants answers exactly as before. One WeKan server per customer remains the supported topology for customers who must not share a process, and the design says plainly what this does NOT isolate. The decisions are three pure modules - models/lib/tenants.js, tenantAdmin.js and tenantBackup.js - so the same rules run on the client, on the server and in the tests. Four new suites pin the separation rather than the plumbing: forged Host headers, cross-tenant queries, privilege escalation and cross-tenant restores. Thanks to xet7 ! |
||
|
|
f0ea1601b3 |
Admin Panel: the board-member restriction moves to Organizations and Teams, as two.
"Add board members only from the same Organization or Team" was one checkbox in the
Login pane - which is where neither of the two things it restricts lives. It is two
checkboxes now, each in the pane it is about:
Admin Panel / People / Organizations [_] Add board members only from the same
Organization
Admin Panel / People / Teams [_] Add board members only from the same Team
A candidate may be added to a board when they share at least one ENABLED kind with
whoever adds them: an Organization when the first is on, a Team when the second is.
With both on that is "an Organization OR a Team" - exactly the rule the single
setting had - so an install that has the old field and neither new one is migrated
to both on first start, and nobody's restriction changes by upgrading. Ticking only
one is the new, narrower choice that was not expressible before.
models/settings.js boardMembersFromSameOrgOnly, boardMembersFromSameTeamOnly
server/models/settings.js the startup migration from the old single field
server/lib/orgTeamRestriction.js
boardMemberRestriction(setting) reads the pair - and
still reads the old field, so an install behaves the
same before the migration runs; canAddUserToBoard()
takes a flag per kind (the old restrictEnabled still
means both)
models/users.js sharesOrgWith / sharesTeamWith, and
sharesRestrictedOrgOrTeamWith(user, restriction)
Enforced in the same three places as before - inviteUserToBoard, the user-search
typeahead that must not offer what the server would reject, and the imported-user
reconciliation - so the two settings cannot drift apart from what the UI says.
Thanks to xet7 !
|
||
|
|
fc0fe31779 |
Admin Panel / Problems: Broken cards is a report, and the menu says which group is which.
Broken cards was the one entry in this menu with a different set of controls: no
search box, no total, no "page X / N", just a prev/next of its own - because it
ran on the global-search machinery (CardSearchPaged, a session document and the
nextPage/previousPage publications) instead of the shared table page. It is a
column spec in REPORT_TABLES now, like Files, Rules, Boards and Cards, driven by
the same loadReport(): a new admin-only `brokenCardsReport` publication takes a
search term plus limit/skip and publishes ONE page manually (a returned
sorted+limited cursor hangs on FerretDB's OpLog, as with the other reports), and
`getBrokenCardsReportCount` gives the total behind the counter.
What "broken" means - no board, swimlane or list, or a type that is not a card
type - is now one selector shared by the report and by the standalone
/broken-cards page, which still runs on the global search and keeps its own
publication unchanged.
The menu is two named groups. Summary, then a rule and a "Settings" title over the
two panes that came from Admin Panel / Features, then a rule and a "Reports" title
over the reports. A title is a new kind of menu item - `{ heading: true, labelKey }`
- with no id, no icon and no handler class, so there is nothing to click, nothing
for the page's click handler to read a data-id from, and it can never be the active
row (or a group name could end up as a pane title). Both use an i18n key the app
already has, so no language has to translate anything new.
Performance moves down to sit with the Speed, Tests and CPU usage streams it is
about, below Impersonation Report - it was three groups away from them, up with the
other two Features panes.
While there: the separator between groups is styled with the menu itself. The rule
for it lived in adminReports.css, twice, targeting a class the shared menu does not
render - so it had never applied to anything.
Thanks to xet7 !
|
||
|
|
d232194070 |
Admin Panel: the tables fit, every pane has a title, and Version opens first.
Reported one after another, all in the Admin Panel, and they turned out to share
two causes: a stylesheet deciding a table's width from outside the design that
owns it, and a pane having to write for itself what every pane needs.
The tables
* Admin Panel / People / People rendered NOTHING - no table, no search box, no
pager. `buildFilters` and `buildActions` were used in peopleTablePageData but
never imported. That is not a build error: it is a ReferenceError thrown inside
a helper while rendering, which Blaze answers by rendering nothing at all.
Organizations, Teams and Domains use neither function, so they drew normally,
which is what made it look like a People-only problem.
* The right-hand side of a table was off screen - reported on Domains, and just
as true of Admin Panel / Version, where the value column was cut off at the
window edge. Two admin stylesheets forced `min-width: 1200px !important;
width: max-content !important` with nowrap cells on a bare `table` selector.
peopleBody.css had no page in the selector at all, so it reached every table in
WeKan, and `!important` beat the shared table page's own width:100% +
table-layout:fixed. The same rules also made a SHORT table shrink to its
content, which is why Domains sat at a third of the panel on a narrow window.
No admin table is forced wide any more: it fits its panel and its cells wrap,
and the phone-width exception that used to undo the floor is simply the rule at
every width. The shared table page's width and wrapping are `!important` now -
a guarantee a stylesheet in another folder can silently override is not a
guarantee.
* An empty table page rendered no table at all, and the "New" link of
Organizations, Teams, People and Translation is a column HEADER - so an empty
pane had no way to create the first row. The table always renders now; the
"no items" message moved below it.
* The controls row: every control shares one height and no margin. forms.css is
`button { display: block; margin-bottom: 14px }`, written for stacked form
buttons, so a button that kept that margin was centred higher than one that did
not - "Unlock all users" sat lower and shorter than "Teams" beside it, since it
also carried a 20px margin and a 28px height from the old hand-written header.
Action buttons are themed with the pager, in the one stylesheet that owns those
colours, every state spelled out, or a bare <button> falls through to the
forms.css fallback, which is literally black.
Admin Panel / Settings / Translation now renders through the shared table page
(docs/Design/Page/Table.md) instead of a hand-written table: four columns, an
interactive row, the "New" link as a column header. It pages ONE page of 25
server-side with limit/skip and a count method, where it used to grow a window by
infinite scroll; the publication publishes the field it is sorted by, so the
client's sort matches the server's page.
The pane title
Every Admin Panel pane opens with the same heading, and the heading is the ACTIVE
LEFT MENU ENTRY's own label - `paneTitle()` in models/lib/leftMenu.js, one class
`.admin-pane-title`, which the shared table page's own title carries too. Before
this only the paginated table pages had a title at all: Domains said "Domains"
while Login, Announcement, Accessibility, PWA and Version opened with no heading.
Deriving it from the menu is what keeps them identical - a pane cannot end up with
a title of a different size or none at all - and it is why a table page inside the
Admin Panel now passes no titleKey: the section already rendered the heading.
The menus
* Version is the FIRST pane of Admin Panel / Settings and the one that opens with
the page, so what an admin sees first is the version, database and system
information they usually came for. Its page, its one-entry menu and its tab are
gone - a page whose menu had a single entry was a page in name only - and
/information redirects to Settings, the same move Translation made.
* Admin Panel / People: Domains moves up beside E-mail, the settings it is about.
* Admin Panel / Attachments: Backup moves to the top.
Tests: tests/tablePage.test.cjs gains the Translation conversion, the empty-table
header, the one-height controls row, the themed actions and a guard that no admin
stylesheet may force a table's width; tests/leftMenu.test.cjs gains the pane title
(helper, template, every page renders it, one shared size) and Version as the
first Settings pane; tests/translationPane.test.cjs is rewritten for the pane that
is left once the shared design owns the table.
Thanks to xet7 !
|
||
|
|
f1c89548e0 |
ZipBleed: a restored backup archive could write outside the files directory.
CRITICAL SECURITY ISSUE (CWE-22 Improper Limitation of a Pathname to a Restricted
Directory, "zip-slip").
A zip entry carries its own path, chosen by whoever built the archive, and path.join()
RESOLVES `..` segments instead of rejecting them. The restore checked only that an
entry's FIRST path segment was `attachments` or `avatars`, then joined the rest onto
the matching directory:
const rel = entry.path.split('/').slice(1);
const kind = rel[0];
if (kind !== 'attachments' && kind !== 'avatars') continue;
const destPath = path.join(attachmentsDir(), ...rel.slice(1));
So an entry named
2026-07-25_12-00-00/attachments/../../../../etc/cron.d/wekan
satisfied that check - its first segment really is `attachments` - and joined its way
clean out of the files directory. With attachmentsDir() = /data/files/attachments it
resolves to /etc/cron.d/wekan, and the entry's contents were streamed there. A crafted
backup.zip could drop or overwrite a file anywhere the WeKan process could write.
restoreBackup is behind requireAdmin(), which is less of a barrier than it sounds:
that is exactly how a hostile archive arrives - offered as a backup to restore, at the
one moment nobody inspects the file they were handed, and nothing in an archive is
visible before it is unpacked.
Fixed in models/lib/backupPaths.js, next to the other pure backup helpers so it is
unit-testable without Meteor: safeEntryPath() resolves the candidate to an absolute
path and requires it to sit under the target directory. It compares against the base
plus a separator, because a bare startsWith(base) also accepts a sibling directory
whose name merely begins with the same letters (/data/files/attachments-evil). An
absolute segment is caught by the same check, since path.resolve discards everything
before it.
The data half of an archive names the Mongo collection to restore into, and that name
came from the entry too, so safeCollectionName() constrains it to a plain
[A-Za-z0-9_-]+ name - which also keeps a restore out of the database's internal
system.* collections, excluded from backups in the first place.
A refused entry is skipped and logged rather than thrown on, so one hostile entry in
an otherwise good archive cannot abort a genuine restore.
This is WeKan's own code, not a dependency: it is the same class as the unzipper
advisory GHSA-884w-698f-927f, but WeKan runs unzipper 0.12.x, which that advisory does
not affect. Found while reviewing the open dependency pull requests.
tests/zipbleed.test.cjs asserts the exact traversal above is refused, that a plain
entry still restores where it belongs, that absolute segments and prefix-matching
siblings are refused, and that the restore really calls both guards. One assertion
reproduces what the OLD code did with the attack path - path.join returning
/etc/cron.d/wekan - so the suite states the danger, not just the remedy.
Tests: 1359 passing.
Thanks to xet7 !
|
||
|
|
4009d92ebd |
Admin Panel / Settings: hide-board-activities becomes a global setting in its own pane.
"Don't show the board activities on all boards" was a BUTTON in the Layout pane that called setAllBoardsHideActivities(), which bulk-set showActivities:false on EVERY board document. That was wrong twice over: it overwrote each board's own value for good, so it could never be undone, and it did nothing at all for boards created afterwards. It is now one global setting - Settings.hideBoardActivitiesOnAllBoards - with its own pane, Admin Panel / Settings / Hide board activities on all boards, saved as Yes/No like the other instance-wide switches. The activity feed reads it ONCE, in _showActivities(), before any per-board or per-card value: when it is on, no board shows activities; when it is off, every board's own setting applies again, unharmed. Boards are never written to. The server method is removed rather than left callable. It was unreachable from the UI after this change and its only effect was the destructive write. Also, per the follow-up: the pane previously labelled "Boards visibility" is now just "Visibility". The label points at a NEW i18n key rather than changing the value of tableVisibilityMode, because that key is already translated into 141 languages as "Boards visibility" - editing the English source in place would have left every one of those translations silently saying the old thing. en.i18n.json had no key meaning "Visibility", so one was added; the pane id and its own key are untouched, so the pane's contents keep their translations. Tests: tests/boardsVisibilitySettings.test.cjs now also covers the activities move - its own pane exists, the Layout button and its handler are gone, the save writes ONE global setting and never a board document, a missing radio is skipped rather than saved as false, the schema field exists, and the read side consults the global flag BEFORE any per-board value. Plus the pane label check follows the rename. Thanks to xet7 ! |
||
|
|
a6d9da4e9f |
Board copy: stop the REST route masking a failed copy as HTTP 200, and guard customFields.
The Playwright test "#5592/#5627 copying a board copies its webhooks and rules"
regressed (passed 2026-07-23, failed 2026-07-24 in all three browsers): the copy
returned HTTP 200 whose body was an object instead of the new board id string.
Cause of the MASKING: `POST /api/boards/:boardId/copy` did
`catch (error) { sendJsonResult(res, { data: error }) }`, and sendJsonResult
defaults the status to 200 when no `code` is given — so a copy that THREW was
reported as 200 with the error object as the body, looking like a success. The
catch now returns 500 with the message and logs the stack, so a failing copy is
a clean error (and diagnosable in the server log) instead of a wrong 200.
Also hardens board.copy() itself: the custom-field remap did
`card.customFields.map(...)`, which throws for a card whose customFields is
absent (the schema defaults it to [], but a card copied via `.direct` or seeded
raw can lack it), failing the whole copy. It now skips cards with no
customFields, matching the `!Array.isArray(this.customFields)` guard already used
elsewhere in the model.
The copy code and the card/swimlane/list models are unchanged in the regression
window, so the underlying throw comes from an infra change in that window; the
500 + server-side log above make the exact error visible on the next run.
Thanks to xet7 !
|
||
|
|
52d68be755 |
Remove the per-swimlane-lists-era board migrations that made spurious "Restored Items" columns and empty-looking cards.
#6521: after upgrading toward 10.33 a board grew a new "Restored Items" column full of cards that looked empty but were not. That column, and the card moves behind it, came from obsolete board migrations that fight the CURRENT data model: * restoreLostCards - created a "Lost Cards" swimlane and a "Restored Items" list (i18n lost-cards / lost-cards-list) and moved cards into them. It called a card "orphaned" when its list was merely ARCHIVED (archived lists are excluded from the set it checks) and "lost" when its swimlaneId was '' - which is NORMAL for a board-wide shared card - so it dragged real, fine cards into "Restored Items". * comprehensiveBoardMigration / fixMissingListsMigration - converted today's board-wide SHARED lists (swimlaneId '') back into per-swimlane DUPLICATE columns, i.e. the exact damage the startup schema step merge-per-swimlane-lists now UNDOES. * restoreAllArchived - un-archived every swimlane/list/card at once. All four had NO callers left - their admin migration dashboard was already removed - so they were dead code exposed only as admin-callable Meteor methods, a footgun that could re-corrupt a board if invoked. They are removed, along with their imports and the stale commented-out imports in 00checkStartup.js. The legitimate paths remain and are correct: the board-open self-heal (repairBoardData) assigns a genuinely missing swimlaneId / relinks orphaned cards to the board's real first list/swimlane, and the startup schema step merge-per-swimlane-lists merges any per-swimlane duplicate columns back into one shared list while cards keep their swimlaneId. It still keys off the era's board markers (fixMissingListsCompleted / comprehensiveMigrationCompleted) in existing data, so removing the code that once wrote them changes nothing for already-migrated boards. Adds tests/obsoleteBoardMigrationsRemoved.test.cjs so these cannot come back. Thanks to hmeunier95 and xet7 ! Fixes #6521, |
||
|
|
1fb382f0eb |
Stop Admin Panel / Problems showing a finished board-repair and info CPU rows.
#6520: the Problems "Status" page showed "Board data-repair — 146/146 boards" running forever (plus a matching "Migration or repair" login warning), and the CPU area showed dozens of "new problems" on an idle server. Board repair stuck at "running": getInProgress() trusted the raw `running` flag. The startup repair DOES write running:false on completion, but its progress callback also fired a NON-awaited running:true write when boardsDone === boardsTotal; being fire-and-forget, that write could land AFTER the awaited completion write and pin the doc at "running, 146/146". A process killed mid-repair leaves running:true too. Both now clear: * the startup progress callback no longer writes the terminal boardsDone === boardsTotal update (the completion write owns the final state), closing the race at the source; * getInProgress() now asks the new pure isStatusActive() instead of reading `running` directly - a doc is "in progress" only while running AND not in a terminal phase (completed/error/done) AND not already finished by count (done >= total) AND updated recently (a running flag with no recent progress write is a crashed run). This also heals docs already stuck on an instance, and fixes the same class of stale flag for the text migration. Because the login "Migration or repair" warning keys off getInProgress(), it clears too. CPU "57 new problems" on an idle server: the count in eventLogProblemAreas counted every unacknowledged row in a stream. The CPU monitor writes one 'detected' row when a high-CPU period starts and several severity:'info' rows ('remediated' when it ends, 'rate-limited' for mitigation, FerretDB governor chatter), so each brief, already-over spike looked like several "new problems". The count now excludes severity:'info' rows (via the new newProblemsSelector) - notices that a problem was handled or cleared are not problems. Rows with no severity are still counted, so nothing unclassified is silently dropped. Both decisions are pure, unit- and negative-tested (statusActive.test.cjs, eventLogProblems.test.cjs), and registered in test:unit:node. Thanks to Alishara and xet7 ! Fixes #6520, |
||
|
|
5a1a661e01 |
Make the drag-handle toggle work on touch screens, and free the card body for panning.
"Show desktop drag handles" did nothing on a touch screen. The rule was isTouchScreenOrShowDesktopDragHandles() = isTouchScreen() || preference so on touch the OR was already true and the toggle could never hide the handles. Every place that decides whether to render a handle - minicard, list header, swimlane header - and every sortable handle selector goes through that one helper, so the setting was inert on exactly the devices that show handles. The setting is now THREE states, not two: on, off, and never-chosen. An explicit choice always wins (including OFF on a touch screen); only when the user has never chosen does the device decide, and then a touch screen still gets handles by default, because a finger needs something to grab. The rule lives in the pure models/lib/dragHandles.js so it can be unit-tested, and the toggle now stores a real `false` instead of removing the setting - that is what lets "turned off" be told apart from "never chosen". toggleDesktopDragHandles takes the explicit new state from the client (which alone knows whether this is a touch device) and still accepts no argument for older clients. Handles also decide what a DRAG MEANS, and that half was broken too: `.minicard` and `.list-header` carried `nodragscroll` unconditionally, so with handles ON a finger dragging across a card neither moved the card (only the handle does) nor panned the board (dragscroll was opted out) - it did nothing. They now opt out only when handles are OFF, i.e. only when the element IS the drag source. With handles on, the card body pans the board, which is the whole point of having handles. And the handle has to be reachable with a finger: it was a 20-28px icon in the bottom-right corner, a mouse-sized target that is close to unusable on a wall-mounted infoscreen. On a coarse pointer it becomes a 48px full-height strip down the leading edge (the Material minimum, and the easiest edge to thumb), with the card content padded to match. A mouse keeps the compact corner handle, since `pointer: coarse` does not match a mouse. Tab order: the keyboard card/list move buttons are focusable but `opacity: 0` and sit at the START of the card content, so tabbing went card (visible focus) -> invisible -> invisible -> next card and the focus ring kept vanishing and reappearing where it looked like it had gone backwards. They are now revealed while focused, the same pattern the skip-to-content link already uses. Adds tests/dragHandles.test.cjs: the three states, that an explicit OFF hides handles on touch (the reported bug), that an explicit choice always beats the device default, and that a corrupt stored value falls back to the device default rather than leaving a finger unable to drag. Thanks to xet7 ! |
||
|
|
aa356d715d |
Run the five test suites that existed but were never executed, and delete dead files.
Five mocha suites sat in the tree looking like they were being run, and were not: `meteor.testModule` points at client/lib/tests/index.js and server/lib/tests/index.js, those indexes list their suites with explicit imports, and these five were never added. server/lib/tests had 49 suite files but 48 imports. Two of them are *bleed security regression suites - checklistbleed (cross-board checklist/checklist-item move denial) and proxybleed (header-login trusted-source and request-IP handling) - exactly the kind of test whose silent absence lets a fixed vulnerability come back unnoticed. The other three are filenameTruncation, alwaysShowCodeAsText and renderLinksPlainText. All five are now imported by their index. Every symbol they import was checked to still exist first: denyCrossBoardMoveByCard / denyCrossBoardMoveByChecklistItem (server/lib/utils.js), getRequestIp / isTrustedHeaderLoginSource / findOrCreateHeaderLoginUser (server/lib/headerLoginAuth.js), truncateFilenameToBytes / sanitizeFilename (models/lib/filenameSanitizer.js), getSecureDOMPurifyConfig / sanitizeHTML (imports/lib/secureDOMPurify.js) and the Markdown export of the wekan-markdown package. They have never run in this state, so they may still fail on their assertions - that is the point of running them. tests/testsAreRegistered.test.cjs is added as a guard: it fails if any *.tests.js file in either directory is not imported by its index, and names the two *bleed suites explicitly so a future tidy-up cannot drop them again quietly. Also deletes files that nothing loads: - client/components/main/responsiveFixes.css (162 lines, imported by nothing, so never in the bundle - package.json sets meteor.mainModule, which disables Meteor's eager loading). - models/backgrounds.js, models/backgrounds.server.js and server/permissions/backgrounds.js - three empty tombstones whose only content was a comment saying board backgrounds became board-level Attachments and the file is "intentionally empty and no longer imported". The live paths (server/boardBackgrounds.js, server/publications/backgrounds.js) are different files and are untouched. Thanks to xet7 ! |
||
|
|
49e576b3c8 |
Add the missing check() calls that made methods throw "Did not check() all arguments".
This app runs with the audit-argument-checks package, so any Meteor method that
RECEIVES an argument it never check()s throws
"Did not check() all arguments during call to '<method>'" - the call fails
entirely, no matter what the method would have done.
problemDetailReport(area) had that defect but nothing had ever passed it an
argument, so it went unnoticed until the new Admin Panel / Problems / CPU usage
header started polling problemDetailReport('cpu') every 5 seconds and the server
log filled with the exception.
Auditing every server method for the same defect found five more that ARE called
with arguments from the client, so these features were failing outright:
- unlockUser(userId) - Admin Panel / People, unlocking a locked-out user
- runBackup(opts, storageName) - Admin Panel / Attachments, running a backup
- restoreBackup(zipPath, mode) - restoring a backup
- saveBackupSchedule(schedule) - saving the backup schedule
- migrateTextDatabase(direction) - the MongoDB <-> FerretDB text migration
and one with no current client caller, getServiceConfiguration(service), fixed
for the same reason.
Each now check()s its arguments against the types its call sites actually pass
(the two optional ones use Match.OneOf(String, null, undefined)), and the three
files that had no check import got one.
Thanks to xet7 !
|
||
|
|
a440d44ea4 |
Remove the cron migration subsystem: it never ran and had no UI.
Nothing scheduled it and nothing rendered it, but every logged-in client still paid for it: - initializeCronJobs() (server/cronMigrationManager.js) was NEVER called, so the SyncedCron.add() registrations and the 5s job-queue processor never started. - boardMigrationDetector.start() sat behind a commented-out Meteor.startup hook, with the note "Automatic migration detector is disabled - migrations only run when opening boards". - The Admin Panel had no Cron page at all: no route in config/router.js, no button in settingHeader.jade, no template ever included, and every helper, event and reactive var for it commented out in settingBody.js. - Yet imports/cronMigrationClient.js WAS imported by client/imports.js, so every client subscribed to three publications and polled cron.getMigrationProgress every 10 seconds, forever, for a feature with no user interface. Migrations already run - and are already reported - through the paths that work: Admin Panel -> Attachments (database migration) and the on-board-open repair, both driven by the shared migrationProgress overlay dashboard mounted app-wide in defaultLayout, plus the in-progress list on Admin Panel -> Problems -> Summary. Removed: cronSettings.jade/.css, imports/cronMigrationClient.js, models/cronJobStatus.js, server/cronMigrationManager.js (28 admin-gated cron.* methods that no UI called), server/cronJobStorage.js, server/boardMigrationDetector.js and the three publications that fed only the deleted client module (cronJobs, cronMigrationStatus, migrationProgress). KEPT on purpose: server/cron/syncedCron.js, which is SyncedCron itself and is used by the backup schedule (server/methods/backup.js) and scheduled rules (server/scheduledRules.js). getInProgress() in server/lib/systemStatus.js no longer reads cronJobStatus. Leaving that check would have been worse than useless: a leftover status:'running' doc from an older version now has nothing to clear it, so Admin Panel -> Problems would report "Migration job X running" forever. The 40 i18n keys that only the deleted template used are left in place - dropping them from every language file would discard human translations for keys that may be reused. Thanks to xet7 ! |
||
|
|
642fa8e93f |
"Map to existing user" now searches every user, not only board members.
After importing a Trello board and choosing to map users later, "Map to existing user" listed only the admin: the picker offered nothing but the ACTIVE REAL MEMBERS of the board, and right after an import the real people have no membership at all - the placeholders do. There was no search box either, so on a board whose only real member is the importing admin there was literally nobody to pick. The picker now has a search box that goes through the same permission-checked `searchUsers` method the normal add-member typeahead uses, so the same board membership check and the same #6116 same-org/team restriction apply. With the box empty it still lists the board's real members (the common case, which changes no roles at all); typing searches every real user and labels the ones who are not on this board yet. Mapping onto a user who is not a board member adds them to the board with the PLACEHOLDER's OWN role - the role the import recorded for that person - never a higher one, and only after passing exactly the checks inviting them would: the Admin Panel "roles allowed to invite" setting, the same-org/team restriction, and the refusal to add a deactivated account. Adding a member with a chosen role is something the board admin doing the mapping can already do through the normal add-member flow, so this grants no capability the caller did not have; an existing active member is still left completely untouched, entry and role. Also fixes sanitizeUserForSearch dropping `profile` from every search result: it read the Mongo-style paths in its allowlist ('profile.fullname') as FLAT keys, so the lookup was always undefined and both this picker and the add-member typeahead showed a blank name with only the username in brackets. Dotted paths are now copied into the same nested shape, still allowlisting exactly the listed leaves. Adds positive and negative unit tests for the new planner contract, including that a comment-only placeholder can never yield an admin, that reactivating an inactive membership does not duplicate the entry, and that the invite policy runs before any write. Thanks to AmigaAbattoir and xet7 ! Fixes #6519, |
||
|
|
f04c484518 |
Show the current CPU usage on Admin Panel / Problems / CPU usage.
The page listed only PAST high-CPU periods (the event rows written by the CPU monitor), so it could not answer "what is the CPU doing right now?" at all - the one question an admin opens that page to ask. A live line now sits between the page title and the search box: the current system CPU percentage, the core count, the 1/5/15 minute load average and the coarse "what WeKan is doing" label, refreshed every 5 seconds and outlined in red while the monitor considers the CPU sustainedly high. The figure comes from getCurrentCpu() in the CPU monitor, which reads the same sample the monitor writes its event rows from, so the header and the rows below it can never disagree. It reads module state only - no sampling of its own - so polling it is cheap. When the background monitor is disabled (WEKAN_CPU_MONITOR=false) it would otherwise always read 0%, so in that case the percentage is measured between calls using a SEPARATE baseline, which cannot disturb the monitor's own delta, and `monitored: false` is reported alongside. Thanks to xet7 ! |
||
|
|
d168a9d302 |
Add a Repair button for "Broken cards N" in Admin Panel / Problems / Summary.
The Summary page reported "Broken cards N" and told the admin to "open the board to auto-repair, or run the repair migration", but there was no button anywhere to run one - and worse, no repair in the app could actually clear that count. countBrokenCards() counts every card missing a boardId OR a swimlaneId OR a listId. repairAllBoards() walks only NON-ARCHIVED boards and only ever sets swimlaneId, so three kinds of counted card could never be repaired by anything: cards on an archived board, cards with a missing listId, and cards with no boardId at all. The count sat there forever with nothing to press. The new repairBrokenCards method (admin only) runs the standard per-board pass and then closes those gaps: orphaned-swimlane cards on archived boards, and cards missing a listId and/or swimlaneId on any board, are assigned to that board's first usable list/swimlane (creating a default one if the board has none). Each board resolves its default list/swimlane once rather than once per card. Cards with no boardId cannot be placed on any board - guessing would drop a user's card onto an unrelated board - so they are reported back as `unfixable` and left alone, never deleted, and the result line says so instead of leaving a count that never reaches zero unexplained. What counts as broken now lives in one pure module, models/lib/brokenCardsRepair.js, used by BOTH the count and the repair, so they can no longer drift apart and leave the admin pressing a button that does not move the number. Progress is persisted through setBoardRepairStatus, so a running repair shows up in the same "in progress" list as the startup pass. Adds unit tests (positive + negative) for the shared rule, including the regression itself: every card the count reports as broken must be either repairable or explicitly unfixable, never silently neither. Thanks to xet7 ! |
||
|
|
668802cd7f |
Speed up Admin Panel / Problems / Cards report loading and prev/next paging.
The report already paginates server-side (25 rows per page via limit/skip), so it never loaded all cards into the browser, but two things made it feel like it did: 1. The cardsReport publication sent WHOLE card documents - description, customFields, vote/poker sub-documents, every date field - when the table renders only six columns. A 25-row page could be hundreds of kilobytes on boards with long descriptions. It now projects title, boardId, listId, swimlaneId, members and assignees only. 2. Every prev/next click re-ran the report's count method as well as re-subscribing. getCardsReportCount counts EVERY card in the database, and the total cannot change just because you moved to the next page, so each click paid for a full collection count plus a second server round trip. loadReport() now takes a `recount` flag: opening a report and searching in it recount, plain paging does not. Both changes apply to the other paginated admin reports too (files, rules, boards, impersonation, recovery), which share loadReport(). Thanks to xet7 ! |
||
|
|
337035eb4c |
Fix #6515: the startup/board-open repair no longer unbinds per-swimlane lists.
repairBoardsOnStartup ran the shared board repair over every board and, via planBoardRepair, cleared swimlaneId to null on EVERY list that had one -- treating any swimlane-bound list as #6484 corruption. But a list with a swimlaneId is a legitimate PER-SWIMLANE list (rendered only in its swimlane via swimlaneLists()), indistinguishable from a #6484-corrupted board-wide list at the data level. So on upgrade to v10.26+ the routine silently unbound every per-swimlane list (the reporter: listsUnbound: 24) and all lists then rendered in every swimlane. Board open re-ran the same repair, so even a manual swimlaneId restore in the DB was nulled again. Remove list-unbind from the automatic plan (planBoardRepair.listsUnbind is always empty; repairBoardData no longer issues the swimlaneId: null write). The card repairs (missing-swimlane, orphaned) are kept. The #6484 CODE bug that could wrongly bind a board-wide list is already fixed, and an admin can still deliberately un-bind a specific board with the explicit repairBoardWideLists method. Affected boards keep their swimlaneIds now; a manual restore from a pre-upgrade backup will stick. Tests: boardRepair.test.cjs updated to assert per-swimlane lists are never auto-unbound and the applier no longer clears swimlaneId. Thanks to jullbo and xet7 ! Fixes #6515, |
||
|
|
50a7c8fe59 |
Fix stale #5623 select-all-swimlane unit test after the doubled-cards fix.
The doubled-cards render fix (
|
||
|
|
5433dfbc5b |
Fix #6508: show "Remap User" for an imported board member — publish authenticationMethod with board members.
Follow-up to the #6508 import fixes: in the board view, clicking an imported (placeholder) board member's avatar showed no "Remap User" action. The board member popup gates it on isImportedMember(), which checks `authenticationMethod === 'imported'` — but the board composite published board members' user docs with only username / profile.fullname / avatarUrl / initials, WITHOUT authenticationMethod (user-miniprofile, which publishes safeFields incl. authenticationMethod, is only subscribed on the import screen). So the field was undefined on the client and the action never appeared. Publish authenticationMethod with the board members' user fields (it is already in Users.safeFields, so this is consistent and not newly-exposed). The in-board "Remap User" -> mapImportedBoardMember flow now works for imported board members. Test: tests/importVirtualMembers.test.cjs guards the field is published. Thanks to AmigaAbattoir and xet7 ! Fixes #6508, |
||
|
|
11cb336161 |
Fix #6511: board shows no cards / "Bad index in range.removeMember" — add a unique _id sort tiebreaker.
The board card list is a Blaze {{#each}} over a LIMITED, ordered reactive cursor
sorted by `{ sort: 1 }`, which has TIES. When several cards share the same `sort`
value (or the same due date, etc.), their order is non-deterministic across
observe/poll cycles, so Meteor's diffQueryOrderedChanges computes an out-of-range
index and Blaze throws `Bad index in range.removeMember: 0`. That aborts the #each,
so the board renders NO cards (and cascades into the `undefined.remove()` teardown
error). An index-backed board card query (a recent fix) can change the tie order and
expose this.
New pure, tested helper models/lib/cardSortTiebreaker.js appends a UNIQUE `_id` key
as the final sort key (object and Meteor array forms; idempotent), making the total
order deterministic so the ordered diff is always well-defined. Applied in
client/components/lists/listBody.js (cardsWithLimit — the crashing #each, before both
the window subscription and the client cursor) and server/publications/cardsWindow.js
(the published limited window, so "first N cards" is stable between polls).
Test: tests/cardSortTiebreaker.test.cjs. Likely also resolves the same
range.removeMember "no cards" reports on other backends.
Thanks to mueschel and xet7 !
Fixes #6511,
|
||
|
|
959cfbb84a |
Activity feed: scope + activityType at top level (not $and) so it pushes down on FerretDB.
The comment-only feed (showActivities off) selected activities with
`$and: [{activityType:'addComment'}, {boardId/cardId: {$in}}]`. FerretDB v1 (SQLite)
does not push down a top-level $and, so the activities collection was full-scanned on
every poll — slow history on a big board. The two keys are distinct, so merging them
into one top-level object is exactly equivalent and lets both push down to the index
(same fix as the 10.22 card-window flatten).
Thanks to xet7 !
|
||
|
|
a51afa5a1b |
Fix boards loading lists but never cards on FerretDB (10.22): drop the null from the card-scope $in so it stays index-backed.
Every board card query used `{ boardId: { $in: [board._id, board.subtasksDefaultBoardId] } }`,
and subtasksDefaultBoardId defaults to null. On FerretDB v1 (SQLite) a $in that
contains a non-string element (the null) does not push down at all, so the WHERE was
dropped and the whole cards collection was full-scanned + sjson-decoded on every
poll-and-diff cycle, across ~7 card cursors per board open. Lists and swimlanes use a
plain boardId equality (index-backed) and stayed fast — so on a big board the columns
appeared but the cards never did.
New helper models/lib/boardCardScope.js builds the scope WITHOUT null and prefers a
plain equality (index seek) when only the board itself is in scope, else an
all-string $in (which pushes down). Applied to every card-scope site in
server/publications/boards.js (8x), cardsWindow.js and cards.js.
Also flatten the lazy card-window selector (cardsWindow.js): the window was
`{ $and: [clientSelector, { boardId, archived }] }`, and FerretDB does not push down
a top-level $and, so boardId/archived were full-scanned too. Merge the board scope at
the top level (exactly equivalent when the client selector has no boardId/archived
key, which it does not — it is a per-list listId + swimlane selector; a collision
guard keeps $and otherwise), so boardId/archived push down.
The FerretDB fork side is hardened separately so a mixed $in (incl. null) also uses
the index. Test: tests/boardCardScope.test.cjs.
Thanks to xet7 !
|
||
|
|
5a1c9a61e9 |
Admin Panel / Problems "Status" overview + snap run wekan.problems: show migrations/repairs in progress and login-page "Must be logged in" causes; run repairs server-side.
Motivated by the 10.16-10.21 reports where, after an upgrade, the login page showed "Must be logged in" or sat on the logo + "Loading, please wait." spinner, pages took 5+ minutes, All Boards counts stayed 0 and i18n showed raw keys — the FerretDB v1 (SQLite) process pegged ~2 cores for a long time under WeKan's poll load, i.e. a migration/repair or a saturated backend, with no way to see it without the Admin Panel. Server-side, independent of any client / progress page: - server/startup/repairBoardsOnStartup.js runs the shared board data-repairs once (version-gated, background, 30s after boot) so corrupted data is fixed even if no user opens a board and nobody watches a progress page. - The MongoDB <-> SQLite text migration and the startup repair now PERSIST their progress to the text_migration_status collection (models/textMigrationStatus.js), so a separate process can see "a migration/repair is in progress" (an in-memory object could not). Status overview (server/lib/systemStatus.js), shown in Admin Panel / Problems -> Summary and via the method systemStatusReport (admin-gated, server/methods/ systemStatus.js): - everything in progress (text migration, board repair, recovery, cron migration, attachment migration) aggregated from the persisted status collections; - detected problems (broken cards; failing login-page checks); - login-page "Must be logged in" / "Loading, please wait" cause checklist (migration in progress, ROOT_URL, LDAP, Sandstorm) — models/lib/loginProblems.js; - a CPU detail area that calls out a pegged ferretdb process and the mitigation. Snap: `snap run wekan.problems` (snap-src/bin/wekan-problems[.mjs], snapcraft app `problems`) prints the same overview as text — problems, migrations/repairs in progress, login checks — so an admin with only server access can see it WITHOUT Admin Panel access. Sub-commands: migrations | login | broken-cards | cpu | help. Pure helpers models/lib/loginProblems.js and models/lib/problemsOverview.js are unit-tested; tests/problemsStatus.test.cjs (14 checks) also source-guards the server hub, method, startup pass, migration persistence and snap command. Thanks to xet7 ! |
||
|
|
136a14c88a |
Shared board data-repairs run on board open AND during the MongoDB <-> SQLite migration, shown in one blue, Product-name-branded progress dashboard.
The board-open self-heal is broadened from the #6484 list-unbind alone to a shared repair set (models/lib/boardRepair.js planner + server/lib/repairBoardData.js): - #6484: lists wrongly bound to a swimlane -> cleared back to board-wide, so the list stops "disappearing" from the other swimlanes; - cards with no swimlaneId (null/''/missing), which never render in the Swimlanes view -> assigned to the board's first swimlane; - orphaned cards whose swimlaneId points at a DELETED swimlane (invisible cards) -> reassigned to the first swimlane. A card on an existing but archived swimlane is NOT treated as orphaned. The same repair set now runs in BOTH places: - Board open: boardBody.js maybeRepairBoard -> boardRepairNeeded / repairBoardData (server/methods/repairBoardData.js), once per board, admin-gated, fire-and-forget. - MongoDB <-> FerretDB v1 (SQLite) text migration: migrateTextDatabase runs repairAllBoards() on the live database BEFORE copying, so the migrated copy is clean too. It reports a new "repairing" phase (boardsDone/boardsTotal/repaired). Both flows drive ONE shared progress dashboard (migrationProgress), now: - mounted app-wide (defaultLayout) so it shows for an Admin Panel database migration as well as a board-open repair; - fed from the DB-migration status poll (attachments.js driveMigrationDashboard); - styled in WeKan blue (#2980b9) instead of the old purple/green; - branded with the configured Product name (from the earlier commit). Tests: tests/boardRepair.test.cjs (planner + server/migration/dashboard source guards, 11 checks) and the updated tests/listUnbindRepair.test.cjs pass. Thanks to xet7 ! |
||
|
|
f559b751b2 |
#6484: auto-detect the "list disappeared from swimlanes" corruption on board open and repair it with a Product-name-branded progress modal.
When a board opens it now checks (boardListRepairNeeded) whether any list is wrongly bound to a single swimlane (the #6484 corruption, which makes a list vanish from the other swimlanes). If so, and the viewer is a board admin, it runs repairBoardWideLists automatically while showing the shared migration-progress modal, then completes. The check runs once per board, fire-and-forget, and never blocks rendering; on error the board is unmarked so a later open retries. The migration-progress modal is now branded with the configured Product name (Admin Panel / Settings / Layout / Product name, Settings.productName), falling back to WeKan when none is set, via the pure models/lib/productName.js helper — so the repair (and every migration reusing this modal) shows the admin's Product name instead of the hard-coded WeKan brand. Tests: tests/productName.test.cjs (helper + modal-branding source guards) and the extended tests/listUnbindRepair.test.cjs (detection method + client detect/repair/progress wiring) pass. Thanks to xet7 ! |
||
|
|
d35532f0f3 |
Add repairBoardWideLists: un-bind lists corrupted by the #6484 swimlane bug.
The #6484 bug (nudging a board-wide list in swimlanes view bound it to one swimlane and moved its cards there, so it vanished from the other swimlanes) is fixed in code, but boards already hit keep the wrongly-set list.swimlaneId. New board-admin-gated method repairBoardWideLists(boardId) clears swimlaneId back to null for every swimlane-bound list on that board, restoring them to board-wide (rendered under every swimlane). Idempotent (lists already board-wide are skipped), scoped to the one board, and returns the count repaired. The list-selection is a pure, unit-tested models/lib/listUnbindRepair.js. Note: this repairs the LIST binding only; cards the bug moved into one swimlane are not restored (their intended swimlane is unknown -- recover those from a backup). Tests: tests/listUnbindRepair.test.cjs (5 checks) covers listsToUnbind (selects bound lists, idempotent, invalid inputs, non-string swimlaneId) and a source guard that the method is board-admin-gated, uses the helper, clears swimlaneId to null, and is scoped to the board. Thanks to xet7. |
||
|
|
5234d09d15 |
Org/Team: the 'Propagate Members To Boards' flag now actually propagates.
#4737/#5850: the per-org/team orgPropagateMembersToBoards / teamPropagateMembersToBoards flag was stored and shown in the Admin Panel, but the propagateOrgTeamMembersToBoards method that acts on it had NO caller anywhere — dead code, so turning the flag on did nothing. The propagation logic is refactored into exported propagateGroupMembersToBoards(kind, groupId) / propagateAllFlaggedGroupsToBoards() (the Meteor method now delegates to the latter), and the flag setters setTeamPropagateMembersToBoards / setOrgPropagateMembersToBoards now run the propagation for that group when the flag is turned ON. Still strictly add-only (existing board members are never removed/modified) and template boards are skipped; the add-only member computation is extracted to a pure, unit-tested models/lib/propagateMembers.js. Tests: tests/propagateMembers.test.cjs (9 checks) covers membersToAddToBoard (add-only, de-dup, already-member, invalid inputs) and source guards that both flag-setters propagate on enable, the method delegates to the shared impl, and it stays add-only + board-type-only. Thanks to xet7 ! |
||
|
|
c0bbacaf94 |
Due-date reminders: honour hour 0 (midnight) and notify card assignees (#3192).
Two source bugs kept due-date reminder mail from reaching people. (1) The reminder hour was parsed as parseInt(NOTIFY_DUE_AT_HOUR_OF_DAY, 10) || 8, so a configured hour of 0 (midnight) silently became 8 (0 is falsy) and out-of-range hours were accepted; parseNotifyDueHour now keeps 0 and rejects anything outside 0..23. (2) A due-card activity's notification participants were only the card CREATOR and its MEMBERS (server/models/activities.js) -- a user ASSIGNED a card but not a member was never notified about it, including its due date; card.assignees are now included too (still gated downstream by the board tracking level, so nobody who is not tracking is newly emailed). The NOTIFY_DUE_* parsing is extracted to a pure, unit-tested models/lib/dueNotificationConfig.js. Note: the built-in reminder still requires NOTIFY_DUE_DAYS_BEFORE_AND_AFTER to be set, and members/assignees are emailed per their board watch/tracking level. Tests: tests/dueNotificationConfig.test.cjs (12 checks) covers the midnight-hour case, valid/invalid/out-of-range hours, the day-offset window parsing and negatives, plus source guards that cards.js uses parseNotifyDueHour and that assignees are in the notification participants. Thanks to SirConfigMgr and xet7 ! Fixes #3192, |
||
|
|
e1ebe978b9 |
Rules: 'remove all members' action now removes the card's assignees (#2674).
The rule member actions operate on a card's ASSIGNEES: addMember calls card.assignMember() and removeMember calls card.unassignMember() (both write card.assignees). The 'remove all' branch (username === '*') however iterated card.members -- a different collection -- so it unassigned nobody a rule had assigned and 'remove every member' silently did nothing. Iterate the card's assignees (card.getAssignees()) instead, snapshotting the ids first since unassignMember pulls from that same array. The single-user add/remove were already symmetric (the earlier #2674 fix that made them assign/unassign); this completes it for the wildcard case. Tests: tests/ruleRemoveMemberAction.test.cjs (6 checks) pins the add/remove symmetry, that the '*' branch reads assignees (not card.members) and still unassigns each, and the defensive skip for an unresolved username. Thanks to sfahrenholz and xet7 ! Fixes #2674, |
||
|
|
18175abef5 |
Docs: 'Fix open issues' process, sandbox build+test, #6500 startup note.
CLAUDE.md gains the 'Fix open issues' process (research newest maintained dependencies via Meteor 3 docs/issues/forums, atmosphere/packosphere/npm, add tests+negative+UI tests, commit format). docs/Security/Sandboxes/vscode/README.md documents a version-matched from-scratch toolchain in .tools/ (Node v24.18.0, npm, Meteor 3.5, newest Go for FerretDB) to build the WeKan bundle + FerretDB and run all tests, and notes Docker/podman is unavailable in the Flatpak sandbox. server/00waitForMongo.js keeps the Meteor.startup wait but documents the #6500 finding: accounts-base creates the users index before app hooks, so a top-level await here deadlocks — the reliable fix is the docker-compose healthcheck. Thanks to xet7. |
||
|
|
80e87f27b8 |
Fix admin Files report empty on FerretDB: avoid $elemMatch in accessibleCardIds
The admin Files report showed "No results" on FerretDB (spec 41 failed in every
Playwright run). Root cause, reproduced against a real FerretDB with the Go Mongo
driver: older FerretDB v1 builds reject {members:{$elemMatch:{userId,isActive:true}}}
with "(BadValue) unknown operator: userId". accessibleCardIds used exactly that
query, and the attachmentsList publication's catch swallowed the error, so the
report silently returned nothing. Current FerretDB handles $elemMatch; the build in
the test harness does not -- which is why board-load tests using a different query
still passed.
accessibleCardIds now matches board membership by the dotted path
{'members.userId': userId} (works on every FerretDB build) and confirms in JS that
the user's own member entry is active, preserving the exact per-element semantics
$elemMatch gives (a userId appears in at most one member entry). Verified with the
Mongo driver against both FerretDB v1.24.2 (was erroring) and v1.37.0: the full
pipeline now returns the 5 seeded attachments on both.
Thanks to xet7 !
|
||
|
|
c6b2377598 |
Files report: surface the hidden publish error + self-localize the e2e test
The admin Files report has shown "No results" in every Playwright run (spec 41), with nothing in the server log — because the attachmentsList publication swallowed any error from its query in a catch that only logged when DEBUG=true. Stop hiding it: the catch now always logs the error (with stack), and under DEBUG the publication logs whether attachmentsReportQuery returned null (the user has no accessible cards) versus a query that matched 0 attachments, so the two failure modes are distinguishable. Spec 41 now localizes the failure itself: it asserts the seed produced a real cardId (so a null cardId, which would make meta.cardId never match, fails with a clear message), and it probes getAttachmentsReportCount directly after opening the report — that method runs the SAME accessibleCardIds + meta.cardId query the publication uses, so if the server count is >= 5 but the table is missing it is a client-render problem, and if it is 0 or errors it is the server query — instead of just "table not visible". No runtime is available in this environment to execute Playwright, so this makes the next run point straight at the failing layer. Thanks to xet7 ! |
||
|
|
c0a1a27847 |
Import: always create virtual users, map later from the sidebar; bound imports
Board import no longer asks for member mapping up front. Every imported member is
brought in as a virtual (placeholder) user carrying its avatar, username and full
name (the existing createPlaceholderUsers path), added to the board inactive with
no permissions. The client import flow is now a single step that imports
immediately with an empty mapping -- no map-members screen, nothing to get stuck
on.
Mapping a virtual member to an existing user is a deliberate, later action done by
a board admin from the board sidebar member-avatar popup ("Map to existing user"),
and CANNOT be used to gain privileges: the new board-scoped method
mapImportedBoardMember only maps a virtual member onto an existing ACTIVE, REAL
member of the SAME board and never changes that member's role (so no new
membership is created and nothing is escalated); authorization and this guarantee
live in the pure planBoardMemberMapping helper. The mapping reassigns the virtual
member's cards/comments/activities ON THAT BOARD to the target and removes the
placeholder from the board.
Automatic hang mitigation so an import can never spin forever: a client watchdog
surfaces an import-timeout and clears the spinner if importBoard does not answer in
WEKAN_IMPORT_TIMEOUT_MS (default 2 min), and the server bounds creator.create with
the same deadline via a new generic withDeadline() wrapper.
Covered by tests/boardMemberMapPlan.test.cjs (no-escalation + auth matrix),
tests/withDeadline.test.cjs (deadline wrapper) and tests/importVirtualMembers.test.cjs
(wiring).
Thanks to xet7 !
|
||
|
|
9ea7f11d27 |
Show a full-page maintenance spinner while data recovery is in progress
#6492: while the SQLite text data is being recovered/remediated, users should see a maintenance spinner instead of errors or half-loaded data. - A published singleton status (models/recoveryStatus.js) carries an "active" flag + message. The publication (server/publications/recoveryMaintenance.js) is PUBLIC so even logged-out users on the sign-in page see it; the toggle method (setRecoveryMaintenance) is admin-only. - The client overlay (client/components/main/recoveryMaintenance.*) shows a full-screen spinner + message when active; it is subscribed globally and rendered in both the app (defaultLayout) and sign-in (userFormsLayout) layouts, above modals/popups. - The startup scripts write a RECOVERY_IN_PROGRESS marker when they restore/re-migrate. On startup the WeKan server (server/recovery.js) shows the spinner while the marker is present, verifies the database serves reads (probe), then clears the marker and the spinner — or, if it still cannot read, keeps the spinner and records that manual recovery is required. Admins can also toggle maintenance for a server-initiated re-migration. Tests: tests/recoveryMaintenance.test.cjs (wired into npm run test:unit:node) — the publication is public while the toggle is admin-gated, the overlay is subscribed and rendered in both layouts above everything, the server shows the spinner from the marker and clears it only after a health probe, and the scripts write the marker. Mirror- validated (no Node runtime here); shell/brace/JSON all checked. Thanks to bluetopaz1204, mueschel and xet7 ! Fixes #6492, |
||
|
|
63c77a27f4 |
Automatic recovery/remediation for the SQLite text data + Admin Panel Recovery report
Completes the #6492 data-safety system on the WeKan side (FerretDB detection/repair/cap landed in the fork): - Decision brain: models/lib/recoveryPlan.js decideRecovery() picks the least-invasive recovery when the database is KNOWN corrupt (latest good backup -> previous backup -> re-migrate from MongoDB -> manual). It never acts on a healthy/unknown database and never restores a known-bad backup. - Startup restore/re-migrate: every FerretDB launch path (snap, bundled release, Docker) can restore the text data BEFORE FerretDB opens the files, on request (WEKAN_FORCE_RESTORE env or a RESTORE_REQUESTED marker). It copies a known-good backup INTO the live database (dropping stale WAL side-files); backups are never deleted and the main wekan.sqlite is only overwritten, never removed. remigrate is delegated to migration-control. Attachments/avatars on the filesystem are untouched. - Recovery events: the scripts append JSON lines to recovery-events.jsonl; the server (server/recovery.js) imports them into the recoveryEvents collection on startup, plus an admin-only recordRecoveryEvent method. - Admin Panel / Problems / Recovery: a new admin-only report (server/publications/recoveryReport.js, wired in adminReports.js/.jade + i18n) lists the remediation history newest-first, readies up front and fetches directly (no hang). - Docs: docs/Features/Admin-Panel/Problems/Recovery.md. Tests (wired into npm run test:unit:node), verified by mirror since there is no Node runtime here to execute them: - recoveryPlan.test.cjs (decision logic, positive + negatives) - recoveryEventsJsonl.test.cjs (parser: skips junk, normalizes severity, never throws) - recoveryReportQuery.test.cjs (search selector escapes regex metacharacters) - recoveryReportWiring.test.cjs (report wired; publication/count/method admin-gated) - ferretdbTextDataBackup.test.cjs extended: restore copies from a backup, is request-gated, and NEVER deletes the live text data or a backup copy Thanks to bluetopaz1204, mueschel and xet7 ! Fixes #6492, |
||
|
|
00ad2c5a68 |
Files admin report: ready() up front + query collections directly (fix spinner hang)
The report was still stuck on the loading spinner: an await in the publish body never resolved, so this.ready() in the `finally` never ran and the subscription never became ready (the report template only renders once ready). Two changes make the publish always reach readiness: - Call this.ready() UP FRONT, before any await, then stream the page rows with this.added — the table populates reactively. The spinner can no longer get stuck regardless of how slow/stuck the fetch is. - Compute accessibleCardIds() by querying Boards / Cards directly with fetchAsync instead of through ReactiveCache, and fetch the attachments page from Attachments.collection directly — raw async fetches always resolve, avoiding the ostrio FilesCollection cursor / backward-compatibility fallback that can hang. Thanks to xet7 ! |
||
|
|
c3c2da2d68 |
Fix Files admin report hang: query attachments collection directly
The 'attachmentsList' publication fetched via ReactiveCache.getAttachments(), which reads through the ostrio FilesCollection cursor; when that returns no rows it falls back to getAttachmentsWithBackwardCompatibility(), whose old-CFS lookups can hang. The hang is INSIDE the publish's try block, so the finally this.ready() never runs — the subscription never becomes ready and the Files report (Admin Panel / Reports / Files) is stuck on the loading spinner, its content pane never rendering (Playwright: the report table never appears in any browser). The other admin reports query plain collections and were unaffected. Query the plain Mongo collection directly (Attachments.collection.find) in both the publication and the getAttachmentsReportCount method. The attachment rows live in that same 'attachments' collection, so a direct find returns the page and always completes: this.ready() fires and the report renders its table. Thanks to xet7 ! |
||
|
|
f79c320d12 |
Fix board-view switch persistence (await) and mobile All Boards 2-per-row grid.
setBoardView Meteor method did not await user.setBoardView(view), so it resolved (and the client reloaded) before profile.boardView was written and a rejected write never surfaced — switching the board view (e.g. to the new Statistics view) was unreliable. Await it. All Boards on phones now lays the board icons out as a real 2-column CSS grid (repeat(2, minmax(0,1fr))) instead of float+width:50%, so at least 2 icons per row is guaranteed regardless of float-logical-value support or how narrow the boards column is (#6488). Thanks to xet7 ! |
||
|
|
e6b001320c |
Fix rules: action never executes because trigger match required omitted fields.
A moveCard trigger has no oldListName (the wizard chooses a destination
list, not a source), but findMatchingRules built the trigger query with
{ oldListName: { $in: [value, '*'] } }. Mongo's $in does not match a
document that is MISSING the field unless null is in the list, so the
trigger never matched and the rule's action silently never ran, with no
error. Add null to the match list for every field (a $in with null also
matches a missing field), exactly like the cardTitle handling (#2345).
Thanks to xet7 !
Fixes #6491.
|
||
|
|
9bcefd9801 |
Fix failing tests from newest run + mobile 2-per-row override + attachments publish robustness
From ../log/2026-07-20_15-26-39 (4 chromium failures; #6490 rules test and spec 42 pass): - Mobile All Boards (#6488): the real 1-per-row rule was .board-list.mobile-view li { width:100% } (added via the isMiniScreen class, more specific than the media-query rule) — set it to 50% too so there are at least 2 icons per row. Seed 12 boards in the test so the list definitely overflows and the scroll assertion is meaningful. - Statistics view test: switch to the view through the actual board-view switcher (js-open-stats-view) instead of pre-seeding profile.boardView, which was flaky (localStorage vs profile / board-ready timing). - Rules Workflow test (#6489): assert the palette renders with labelled chips (the exact bug signature) instead of driving HTML5 drag-and-drop, which Playwright's dragTo does not fire through Blaze's delegated handlers here (the Add Rule button stayed disabled). - attachmentsList: wrap the manual publish so this.ready() always runs (finally) and drop the server-side name sort (no index; the client re-sorts) — defensive against the still-unresolved Files-report hang. |
||
|
|
dded8ed476 |
Admin reports: manual publish (no limited live observe) so they load on FerretDB
Apply the same fix as attachmentsList to the sibling paginated reports rulesReport, boardsReport, cardsReport and impersonationReport: a returned sorted+limited cursor makes Meteor set up a LIMITED live observe that hangs on FerretDB's OpLog, so the report stays stuck on the loading spinner. Each now fetches its page and the referenced docs and publishes them with this.added + this.ready (into rules/actions/ triggers/boards, boards/users/team/org, cards/boards/lists/swimlanes/ users, impersonatedUsers/users respectively). No live cursor is needed since the reports re-subscribe on every page/search change. Add a Playwright test (spec 41) that opens each report and asserts it loads (its search input renders once the subscription is ready). |
||
|
|
92a0d53fad |
Fix admin Files report hang on FerretDB + correct #6479 test selectors
attachmentsList returned a sorted+limited live cursor, so Meteor set up a LIMITED live observe, which hangs on FerretDB's OpLog for this query: the subscription never became ready and the Files report was stuck on the loading spinner forever (spec 41). Publish the page manually (fetch + this.added + this.ready) so ready always fires; the report re- subscribes on paging/search, so it needs no live cursor. Also fix the two new #6479 Playwright tests: they located the member avatar via '.membersWidget' which is a Blaze template NAME, not a DOM class, so it never matched. Use the real sidebar container '.board-sidebar' instead. |
||
|
|
abc0f180fa |
Board Settings: add read-only Status popup (mode, counts, time-spent summary)
New 'Board status' item in the board menu opens a larger, mouse- selectable popup showing this board's card-loading mode (lazy vs all, and whether chosen automatically), counts (swimlanes, lists, cards, archived cards, labels, members, custom fields) and a time-spent summary in the style of the task time reports (total hours, cards with time, overtime cards). Counts come from a server boardStatus(boardId) method so they are accurate even in lazy mode, where minimongo only holds the visible card window; the time summary fetches only cards with spentTime > 0 so it stays cheap on big boards. New i18n keys translated to major languages (rest fall back to English). Design doc at docs/Features/Board/Sidebar/Status.md. |