mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
dcefd4b367cec460e6e8b7d23cbdbb758eef5c19
1781
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6c1d62cde0 |
Admin reports show the instance, not the admin's own boards.
Boards Report was empty while the Cards report beside it listed cards from thousands of boards. It published userBoardIds(this.userId) - the boards the ADMIN is personally a member of - and on an instance whose admin is not a board member that is nothing at all. Until the pagination fix the pane hid this: it rendered every board in minimongo, which the All Boards page had already put there. The Files report was scoped the same way, to the cards the admin can access. Both now cover the whole instance, like Cards, Broken cards, Rules, Impersonation and Recovery already did. The membership selector was what kept those two publications honest, so both gained an isAdmin guard at the top - boardsReport asked only for a logged-in user before - and both count methods count the same set they page. Files and Rules also name their page now, like the other reports: opening one card puts its attachments in minimongo and opening a rules editor puts that board's rules there, and neither belongs in a report page. The Files page is sorted by name - paging with no sort is paging over natural order, where a document can appear on two pages or on none - and that sort has an index now. Thanks to xet7 ! |
||
|
|
c1add5bc5e |
Paginate the admin lists honestly: one page of ten, index-backed.
Admin Panel / People showed the admin on every one of its 578 pages, and Admin Panel / Problems / Broken cards was one endless page under a pager that said "1 / 1". Same bug in two shapes: the pane subscribes to a publication that sends exactly one page, then reads the page back out of minimongo - which holds far more than the page. The logged-in user's own record is always there (accounts publishes it), and so is every card of every board the admin has opened. A plain find(query) cannot tell those apart from the page. So the server names the page. getPeoplePageIds returns the ids of the People page with the publication's own selector, sort and window; the Broken cards, Cards and Boards report publications send the ids of the page they just sent alongside it. Both panes render that list, in that order, and nothing else. Every paginated page in WeKan now loads ten rows at a time, from one constant - TABLE_PAGE_ROWS_PER_PAGE - including the pages that draw a pager of their own: the reports and event streams, the four People panes, Translation, the search pages and the archive. docs/Design/Page/Table.md records the rule and its two deliberate exceptions. And the counting behind those pagers is index-backed. Every count already asks the database for a count rather than fetching the rows, but several counted and paged on unindexed fields: People sorts users newest-first, so on an instance with 14000 users each page of ten sorted all 14000 first. Broken cards asks an $or over boardId/swimlaneId/listId/type, which uses no index at all unless every branch has one. The missing indexes are created at startup by the idempotent ensureIndex, so an upgrade adds them by itself. Thanks to xet7 ! |
||
|
|
c2fa9e0b3d |
Every upload threw in getFileStrategy, so no new file was mime-checked.
From the dev-server log, on a plain attachment upload:
[onAfterUpload] filename hardening failed: TypeError: Cannot read properties
of undefined (reading 'gridFsFileId')
at FileStoreStrategyFactory.getFileStrategy (models/lib/fileStoreStrategy.js:112)
at detectStoredFileMime (models/lib/fileTypeCorrection.js:120)
at FilesCollection.onAfterUpload (models/attachments.server.js:215)
`getFileStrategy` decided the storage like this:
storage = fileObj.versions[versionName].storage;
if (!storage) {
if (fileObj.meta.source == "import" || fileObj.versions[versionName].meta.gridFsFileId) {
A freshly uploaded file has no `meta` on its version - only a GridFS one does -
so that last read threw on EVERY upload. onAfterUpload catches and logs, so the
upload itself succeeded and looked fine, while the two things that hook does were
silently skipped for every new file: detecting the real mime type and correcting
the stored filename from it. `fileObj.meta` can be absent the same way, and so
can the version itself when a caller asks for one this file does not have.
All three reads are defensive now, and the decision is unchanged where the data
is there: a stated storage wins, an explicit argument wins over that, an import
or a GridFS version is still GridFS, and everything else is the filesystem.
tests/fileTypeCorrection.test.cjs replays that decision table, including the
document shape from the log (a version with no meta), a missing version, and no
file object at all - and fails if the unguarded read comes back.
Thanks to xet7 !
|
||
|
|
1f4bf0be13 |
Migrated images show in the card view again.
Reported after upgrading from WeKan 6 to 10.37/38/40: an attached image is
visible in board view, downloads correctly from the card, and yet the card view
shows an empty white box that cannot be maximized. Cards created AFTER the
upgrade are fine.
The card view does not look at the file; it looks at the flags Meteor-Files
writes at upload time:
if(isImage) img.attachment-thumbnail(src="{{link}}")
...
else span.attachment-thumbnail-text= extension
An attachment that came through a migration can arrive without them - no
isImage, and often no `extension` or `type` either - so it fell through to the
last branch and printed an extension that was not there: an empty box. The same
`link` in the download button worked, because a download needs no flag. The
viewer refused to open it for the same reason.
The kind of a file is derivable, and models/lib/attachmentKind.js is now the one
place that derives it: from the mime type where the document has one (in any of
the fields that have carried it over the years - type, mime, mime-type,
contentType, versions.original.type), and from the file NAME where it does not.
A flag the document states as true is believed, never contradicted; the name is
consulted only when there is no stated type, so a notes.txt that really is
image/png stays an image and does not also become text. The card gallery, the
"add cover" menu and the viewer all ask it, so a thumbnail that renders can also
be opened.
A startup repair (schema upgrade step `attachment-kind-flags`) writes the same
answer back to the documents, so the REST API, the exports and everything else
reading those flags agree with what is on screen. A file whose kind cannot be
told from either its type or its name is counted as unresolved rather than
guessed at.
tests/attachmentKind.test.cjs pins the rules - the reported case first - and the
wiring: 17 kinds derived from a name alone, mime beating a misleading name, a
name that must not be trusted to be a plain name (path separators, query
strings, dotfiles), the type read from each of the fields that carry it, and a
repair that writes exactly what is missing and nothing else.
NOT verified here: no server and no node in this environment, so the rules were
replayed against a model of the module rather than executed. That replay caught
three real mistakes in the first draft (a query string eating the extension, a
name overriding a stated type, and the repair rewriting a document that was
already correct), which are fixed.
Thanks to S0QR2 and xet7 !
Fixes #6532,
|
||
|
|
3487d2519d |
One icon set: Font Awesome. The Grey Icons feature is removed.
WeKan used colourful Unicode emoji as its icon set in 8.00-8.24 only; before and after, the icons are Font Awesome 4.7. A handful of emoji had survived that change - every notification type, the board star, the vote-against thumb, the spent-time badge, the reaction and add buttons, the list width toggles, the bookmarks star, the back arrow, the custom-field pencil, the notification bin, the sidebar's plus and hash, the four date badges in cardDate.css and minicard.css, the mobile drag handle, the multi-selection tick, and the gantt day markers. Each of those is a different picture on every platform, at a size and colour the stylesheet does not control. They are Font Awesome glyphs now: either an `i.fa` element, or the codepoint (`content: "\f11e"`) with the font named, since `time::before` is not an `.fa` element. The helpers that produced an emoji return a class name instead, and their templates render an `<i>`. "Grey Icons" in Member Settings existed to grey exactly those emoji. It ran a MutationObserver over every rendered subtree, for the whole session, wrapping any text node that was one of ~50 emoji in a span it could greyscale - and only 13 of those emoji were still anywhere in the app. With them gone it has nothing left to find, so the feature is removed whole: the menu entry, the click handler, the `toggleGreyIcons` method, the `hasGreyIcons` helper, the `profile.GreyIcons` schema field and its published-fields entry, the `userGreyIcons` publication and its subscription, unicode-icons.js/.css and the feature import, twelve `body.grey-icons-enabled` CSS rules across six stylesheets, the `grey-icons` string in all 147 language files, the field in public/api/wekan.yml and wekan.html, and the two mentions in docs/DeveloperDocs. The language flags in the language picker stay: Font Awesome 4.7 has no flags. tests/fontAwesomeIcons.test.cjs fails on an emoji in any template or any CSS `content:`, checks the date badges name the font and use the four codepoints, checks the icon-producing helpers return class names, and checks that no part of the removed feature is left anywhere. 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 !
|
||
|
|
19a5ea0b71 |
Theme: every named theme publishes its accent, so the whole UI follows it.
Choosing a named theme recoloured the header - which has a `.board-color-<name>#header` rule of its own - and left everything that reads the `--theme-accent` CSS variable on the stock blue: the Admin Panel's selected left-menu row, its pane buttons, every Save button, the table-page controls and the popup header. That variable was only ever set when a user picked a CUSTOM colour for a flat/clear theme. models/lib/themeAccents.js now maps every allowed theme to the colour that theme paints its header with, and globalThemeColor.js publishes it as --theme-accent whichever theme is in force: the user's own override, the board's colour, or the site theme. A custom colour still wins over it, and the has-custom-theme-* classes stay tied to a custom colour - they exist to override a named theme's own header rule, which a named theme must not do to itself. tests/themeAccents.test.cjs parses boardColors.css and fails if the map and the stylesheet ever disagree, so a theme cannot be added in CSS alone and quietly fall back to blue. The Admin Panel edit popups (Edit User, Edit Organization, Edit Team) also got their layout fixed: they are centred on the window rather than positioned from the table row that opened them - which pushed their right-hand side, and the Save button, off the screen - and their fields lay out in as many columns as the window has room for, so a long form no longer has to be scrolled to reach Save. No popup can be wider than the window any more. And two smaller things in the Admin Panel: the Wait Spinner setting shows a live preview of the spinner beside its dropdown, which wraps below the dropdown when there is not enough room; and the Translation table's New column moved to the left, where every other Admin Panel table page has it. 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 !
|
||
|
|
d34d281595 |
Admin Panel: the left menu is back on every page.
Settings, People, Features, Attachments, Version and Problems all rendered an empty
panel where their left menu belongs.
The seam between the two halves of the shared menu was wrong. leftMenu.jade iterates
`each items`, and every page handed it the bare ARRAY that buildMenuItems returns - so
Spacebars looked `items` up ON the array, found nothing, and rendered nothing. The
template's own comment said the data context is `{ items }`; the six call sites did
not provide it.
Nothing failed anywhere: the template was correct, the helper was correct, every unit
test passed, and the menu was simply not there. Six pages lost their navigation to one
mismatched shape.
A new leftMenuData() states that shape once, in models/lib/leftMenu.js, and all six
pages build their context through it. buildMenuItems keeps returning an array, which
is what activeCount and the tests want.
The guard that was missing is the one that checks the SEAM rather than either half:
it reads which variable leftMenu.jade iterates, calls leftMenuData, and asserts the
returned context actually has an array under that name - so renaming the loop variable
or handing back an array fails the suite. A second test asserts no page calls
buildMenuItems directly in its menuItems helper, since that is exactly the mistake
that empties one page's menu while the others keep working.
Verified both fail when the bug is put back, then pass again when it is removed.
Tests: 1346 passing.
Thanks to xet7 !
|
||
|
|
13f40bf3ab |
Table page: row and header slots (option A), and Organizations converted.
Organizations could not be expressed as a column spec: its rows carry inline checkboxes and edit links, and three of its headers carry a select-all pair. The design gains two slots rather than those panes staying outside it: - rowTemplate + docs - the page supplies a template and one data context per row, and owns its <tr>. It is then responsible for matching the column count: the guarantee that a row can never be shorter than the header holds for the CELLS form only, and the doc says so. - headerTemplate + headerData on a column - the <th> still belongs to the shared template; only its contents come from the page. Everything else stays shared either way: layout, paging, search, the themed pager, the total. The doc says to prefer the column spec and reach for these only when a pane is genuinely interactive. Organizations now renders through the shared page - 1826 characters of its own table markup gone, plus its .org-pagination rules from both stylesheets, since it uses the shared pager. Its three feature headers share ONE new template parameterised by feature, instead of three copies of the select-all pair. One thing the conversion forced: all of People's panes render inside the SAME template, so a handler bound to a shared control class fires for every converted pane at once. The org pager is scoped to the open pane via activeMenuId - Domains was unaffected because its handlers live on its own child template. Tests: the two slots exist and the plain column path is unchanged; Organizations renders the shared page, keeps no table markup, uses both slots, and scopes its pager. Two doc/test pairs updated to say "Domains and Organizations". Five panes remain: Teams, People, Locked users, Roles, Shared templates. 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 ! |
||
|
|
1c1aefbd16 |
Admin Panel / Attachments: render its side menu from the shared left menu.
The last of the seven. 2525 characters of menu markup became one +leftMenu(menuItems); Attachments already tracked the open pane in activeSection, so nothing had to be derived, and its single click handler is untouched - the shared template puts js-attachments-menu on every entry alongside the shared class. One template addition: the Sandstorm entry is a proper noun, not a translated string, so an item may now carry a literal `label` where the others carry a `labelKey`. The Sandstorm-only condition survives as data, a null the builder drops, rather than markup wrapped in `if isSandstorm`. All seven Admin Panel pages now render the same menu from a data list. Across them: 8393 characters of duplicated markup gone, 44 entries described as data, and 19 near-identical click handlers collapsed to 7 - one per page. Tests: a check that ALL seven render the shared menu and none keeps .side-menu markup of its own - the design is only worth having if nothing is left outside it - plus the Sandstorm entry and the literal-label fallback. Remaining: People's seven pane tables still need converting to Table.md. Thanks to xet7 ! |
||
|
|
7e2f33387e |
Table page: adopt People's filter, actions and total into the shared controls row.
The three features that kept Admin Panel / People off this design are now part of
it, and they are ON by default - there is no enabling flag. A page that supplies a
filter or an action gets it rendered, and the total is shown whenever the page
knows one:
filters: buildFilters([{ id, labelKey, options: [{ value, labelKey }] }], current)
actions: buildActions([{ id, labelKey, icon, cls }])
total: <number> (+ optional totalLabelKey)
They are general - a Boards or Cards report wants a filter and a total as much as
People does - so they belong in the one template rather than in a per-page copy.
The controls row now reads: search, filters, actions, total, pagination.
A page identifies which control was used by its data attribute (data-filter,
data-action), so this adds no new handler pattern: the same one-handler-per-page
rule as the search and the pager.
The option matching `current` is selected as STRINGS, so a numeric filter value
still selects. The total sits with the controls, not in the table, because it
counts the whole result set rather than the page, and inherits its colour so it
stays readable on a dark theme.
Tests: the two new helpers (including junk input - a filter with no options
renders an empty select rather than crashing), that the four parts appear in
reading order between the search field and the pagination, that there is NO
opt-in flag, and that the doc says so.
One earlier guard needed fixing rather than the code: "the table page stylesheet
does not restate button colours" sliced the CSS by POSITION, so the new rules
landed inside the slice and tripped it. It now matches by selector, which is what
it always meant.
NOT done: People itself still renders its own markup. Its seven panes
(Organizations, Teams, People, Domains, Locked users, Roles, Shared templates)
are seven tables with their own columns and handlers, and converting them is a
larger piece of work than adding these features was. The blocker recorded in
Table.md is now gone, so that conversion is unblocked - the "Pages that do not
use this design" entry stays until it is actually done.
Thanks to xet7 !
|
||
|
|
f46aab011b |
Admin Panel / Problems: render its side menu from the shared left menu.
First page converted to docs/Design/Page/Left-Menu.md. Its thirteen entries were
six lines of markup each plus, for twelve of them, an identical click handler.
They are now a data list:
{ id, icon, labelKey } and { separator: true }
built by buildMenuItems() and rendered by the one leftMenu template. 1895
characters of markup in adminReports.jade became a single +leftMenu(menuItems).
Same styling, deliberately: the shared template reproduces all three icon shapes
the Admin Panel pages already used, so a conversion changes no pixel - an empty
span.emoji-icon before the icon (Settings, Features), the icon inside a coloured
span.emoji-icon (People / Locked users), or a bare i.fa (Problems, People,
Translation, Info). Problems uses the bare shape it had.
The twelve 'click a.js-report-<name>' handlers, all of which called switchMenu,
are one 'click .js-left-menu-item'. switchMenu no longer toggles the active class
by hand either: the active row is rendered from activeReport, so the manual
removeClass/addClass would have fought the next re-render. Its "already open"
guard now compares ids instead of reading a DOM class, and it resolves data-id
from the anchor rather than event.target, which may be the icon inside it.
Three suites looked for the menu ids in adminReports.jade; the menu is DATA now,
so they read the .js. Same intent, right file.
Tests: tests/leftMenu.test.cjs gains the conversion checks - the page renders the
shared menu, keeps no .side-menu markup of its own, builds its entries through
the shared helper, has exactly one menu handler and no manual active-class
toggling, and the three icon shapes are reproduced.
Still to convert: Settings, People, Features, Attachments, Translation and Info.
Settings, Features and the two single-entry pages are the same mechanical swap.
People and Attachments additionally need an active-id reactive var, because they
track the open pane by toggling a DOM class rather than in state.
Thanks to xet7 !
|
||
|
|
33a0cf6160 |
Design docs: move Table-Page.md under Design/Page/, and add Left-Menu.md.
docs/Design/Table-Page.md -> docs/Design/Page/Table.md, with every reference updated: the three design docs that link to it (History, CPU-usage, Recovery), the code comments in the shared template, stylesheet and helpers, and the four test suites that read it. Its own link to History.md is re-based, since the file is one level deeper now. docs/Design/Page/Left-Menu.md is the second page design: the menu beside the content on every Admin Panel page. It records what those seven menus share, which pages use it, the entry shape, and how a page adds one. Which side it is on is part of the design, not an accident of the markup: for a left-to-right language the menu is on the LEFT with the content to its right; for a right-to-left language the whole panel MIRRORS - the menu is on the right, the content to its left, and inside each entry the icon and label mirror too. That works only through the document direction plus logical CSS, so the doc says to never write left/right/margin-left/padding-left for this menu. Checking that turned up two places where the current CSS did exactly that: - .side-menu had `box-shadow: inset -0.2vh ...`. An inset shadow offset on the X axis is a PHYSICAL direction and does not mirror, so it shaded the wrong inner edge once the menu moved to the right. The X offset is dropped. - the entries used `padding: 1.3vh 0 1.3vh 1.3vw`, i.e. padding-LEFT, so under an RTL language the indent stayed on the left - the outer edge of a right-hand menu. Now padding-block + padding-inline-start. Theme: the menu was entirely hard-coded greys. Most of it stays neutral on purpose - it is chrome, and tinting the whole card would fight the content beside it - but the entry you are ON now takes the per-user theme accent (Member Settings -> Change color sets --theme-accent on :root), with `inherit` as the fallback so the WeKan default look is byte-for-byte unchanged when no colour is chosen. No brand colour is hard-coded in the menu. The shared pieces are in place: client/components/settings/leftMenu.jade renders the menu from an item list, and models/lib/leftMenu.js turns (items, activeId) into it - marking exactly ONE entry active, dropping conditional holes, and supporting group separators. Tests: tests/leftMenu.test.cjs is the one suite for this design - the pure helpers, the template, the mirroring, the theming, the shared narrow-window stacking, and that every path in the doc's related-files table exists. NOT done yet: the seven Admin Panel templates still render their own copy of the menu markup. Converting them to +leftMenu is the next step; the design, the template, the helpers and the tests it will be checked against are ready. Thanks to xet7 ! |
||
|
|
9791993d59 |
Table pages: one design, one implementation, and a layout that fits the window.
Files, Rules, Boards, Cards, Impersonation, Recovery and the four event streams
(Security, Speed, Tests, CPU usage) were ten copies of the same page: the same
title + search + prev/next markup, the same currentPage/totalPages helper pair,
and the same click/keydown handlers, retyped with a different js- prefix each
time. They had drifted apart, and any layout fix had to be made ten times.
They now render through ONE template and differ only in a column list:
{ label | labelKey, value(doc), align, nowrap, cls, userId(doc), data(doc) }
- client/components/settings/tablePage.jade - title, optional status row,
controls, table. The row ORDER is defined here once.
- client/components/settings/tablePage.css - the layout.
- models/lib/tablePage.js - pure pageInfo() / buildRows() / buildHeader() /
columnWidthPercent(), unit-tested without a browser or a database.
adminReports.jade 349 -> 112 lines, its CSS 134 -> 53, ten templates -> four,
twelve page/total helpers -> none, twenty-four control handlers -> four.
Layout fixes, now made once and reaching every page:
- The table is width:100% with table-layout:fixed, so every column gets the SAME
percentage of the width and the table can never grow wider than the panel. With
the default auto layout one long id or file name widened the table past the
panel and pushed its right-hand columns outside the browser window.
- Cells wrap: overflow-wrap:anywhere breaks even an unbroken id, URL or file name
inside its column. Datetime columns opt out with nowrap.
- .table-page has min-width:0 / max-width:100% so it can shrink inside the flex
.main-body instead of setting a min-content floor; only the table's own wrapper
may scroll sideways, never the page.
- At <= 800px the side menu goes full width on top and the table sits BELOW it.
This deliberately overrides the older "always side by side, even on narrow
windows" rule, which on a phone left the table a few dozen pixels wide with its
right-hand columns unreachable. Above that width the menu keeps its place and
the table sits beside it.
- Rows top to bottom: title, status (the live CPU figure on the CPU usage page),
controls, table.
Paging still loads only the current page - the publications apply limit/skip -
and loadReport now takes that window from the SAME pageInfo() call that renders
"page X / N", so what is fetched and what is displayed cannot drift apart.
Docs: the shared design moves out of the History design doc into
docs/Design/Table-Page.md, which lists every page that uses it (table name, menu
path, description) per group. History.md, CPU-usage.md and Recovery.md now link
to it and keep only what is specific to them.
Tests: tests/tablePage.test.cjs (18) covers the pure helpers - including a page
that no longer exists clamping to a real one, and a short row never shifting the
columns - plus the layout rules the doc promises and the "one implementation"
guarantee. Four existing tests that pinned the old per-report markup were updated
to the new mechanism, same intent.
Thanks to xet7 !
|
||
|
|
f92b49d1b0 |
Board copy: use the async default-swimlane getter so a copy no longer throws on the server.
This is the actual cause of the failing "#5592/#5627 copying a board copies its
webhooks and rules" test (all three browsers) — surfaced now that the copy route
returns 500 + logs the stack instead of masking it as 200. The server log shows:
Error: update is not available on the server. Please use updateAsync() instead.
at ensureDefaultSwimlaneId (models/boards.js)
at getDefaultSwimline (models/boards.js)
at Swimlanes.copy (models/swimlanes.js:202)
swimlane.copy() (server, async) called the SYNC getDefaultSwimline() on the source
board to detect its default swimlane. When the board has no pickable swimlane that
getter self-heals via a synchronous Swimlanes.upsert(), which Meteor 3 rejects on
the server, aborting the whole board copy. It now calls the existing
getDefaultSwimlineAsync() (same pick + idempotent upsertAsync self-heal) and awaits
it, preserving the previous null-safety.
The same sync getDefaultSwimline() is still called from other server paths
(models/cards.js, server/models/lists.js, server/rulesHelper.js, swimlanes.js:365);
they only throw when a board has no usable swimlane and are not hit by the current
tests, so they are left for a separate, tested change.
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 !
|
||
|
|
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, |
||
|
|
c0e71705f6 |
All Boards: a live drop gap that follows the drag, in place, not just at the end.
Replaces the fixed "drop at the end" placeholder with the standard sortable feel:
while a board is dragged, an empty dashed gap opens up before or after the tile
under the cursor, showing exactly where the board will land - anywhere in the
current view (Starred / Templates / Remaining / a workspace), not only at the
end.
How it works:
* `dragover .js-board` computes which side of the tile the cursor is on
(inline-centre, RTL-aware) and inserts a placeholder `<li>` there. The
placeholder is a plain DOM node, inserted next to the Blaze-managed tiles and
removed on dragend, so it never fights Blaze's reactive list.
* `drop .js-board` reads that side and reorders with the pure
computeReorderedIds(..., after), which now inserts on the target's leading OR
trailing side and returns null for a no-op (including a drop back into the
board's own slot). Dropping past the last tile reaches the end, so the
separate end target is gone.
The placeholder is a real grid cell, so the surrounding tiles flow around the gap
as it moves. Unit tests cover the new before/after side and the own-slot no-ops.
Still mouse-only: HTML5 drag-and-drop does not fire from touch (the jQuery-UI-
sortable + touch-punch move noted before is what would add finger dragging).
Thanks to xet7 !
|
||
|
|
da64c8a0f1 |
All Boards: add a trailing drop placeholder to move a board to the end.
Dropping one board onto another can only place it BEFORE that board, so the last slot in the order was unreachable by drag. A dashed "drop here to move to the end" tile now sits after the last board (only in the manual "custom" sort mode, where drag-reorder applies) and accepts a drop that moves the dragged board to the end. The move-to-end order math is the pure computeReorderedSortIndexToEnd in models/lib/boardSortReorder.js (a no-op when the board is already last); the dragover/drop handlers mirror the board-tile ones and light the placeholder with the same `.board-reorder-over` highlight. Thanks to xet7 ! |
||
|
|
b09510c41a |
Fix INVALID [400] when drag-reordering boards: add the missing schema field.
Dropping one board onto another to reorder threw INVALID [400]. setBoardSortIndexes
writes `profile.boardSortIndex` from the client via Users.updateAsync, and the
user `profile` object ENUMERATES its subfields in the schema (it is not blackbox)
- but `profile.boardSortIndex` had no schema entry, so SimpleSchema rejected the
update with a 400.
Added the entry next to the analogous `profile.autoWidthBoards` /
`profile.fixedListWidthBoards` (type Object, defaultValue {}, blackbox, optional).
The #6439 drag-reorder now persists instead of erroring.
Thanks to xet7 !
|
||
|
|
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 ! |
||
|
|
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, |
||
|
|
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 ! |
||
|
|
52325228f8 |
Fix 6 pre-existing unit-test failures (stale source-guards + a cleanup race).
These failed before the ESM conversion and are unrelated to it: - addBoardTileHeight: the .path-right slice window was 1600 chars but js-board-search-input is at offset 2517 after the header grew; widen to 3000. - listWidthDefaults: isValidListWidth(269) is TRUE (269 >= MIN 200, no upper bound); drop 269 from the "invalid widths" list. - uiDensity: the js-open-board-menu cog moved to sidebar.jade; read that file. - exporterBackpressure: the leaky-pattern guard matched the pattern quoted in an explanatory comment; strip // comments before matching. - adminReportsPagination: a 6th report section was added; expect 6 .admin-report-controls, not 5. - fileTypeCorrection (real fix): streamHeaderToTemp unlinked the partial temp file fire-and-forget, racing the async write-stream open, so a caller could still see the file after the rejection. Remove it only after the write stream has closed, then reject. Remaining known failure: rulesApiTriggerNormalize (#2674 $in-matching) — left for a maintainer decision on the intended rule-normalization contract. |
||
|
|
d6908cf418 |
Convert client-reachable CJS helpers from CommonJS to ES modules (2/2).
A transitive walk from client/main.js found the remaining CommonJS
(module.exports) helpers that the rspack client build pulls into the ES
module graph and rejects: 3 client/lib helpers (cardDragGeometry,
inlinedFormManager, popupOffset), 4 imports/lib helpers (boardAutoScroll,
datePickerTime, fileNameDisplay, staleWhileRevalidate), imports/simpleSchema
(its meteor/aldeed:simple-schema require becomes a namespace import),
imports/i18n/loadHelpers, and 4 more models/lib helpers (cardLinkRedirect,
sandstormAutoOpen, securityCategories, securityLogFormat). All become
`export { ... }`; their .cjs unit tests use `await import(...js)`.
The only CJS files still reachable in the walk are server-only: the
server/lib/* files (Meteor never bundles server/ to the client) and the
fs-using models/lib file-storage helpers (reached only via the server-side
fileStoreStrategy; they would fail on require("fs") if they were actually in
the client bundle). Those correctly stay CommonJS.
Full tests/*.test.cjs suite: same 7 pre-existing failures, no new ones.
|
||
|
|
8d1fae4f7d |
Convert client-reachable models/lib helpers from CommonJS to ES modules (1/2).
The rspack client build treats a `module.exports` file imported into the
client bundle as an ES module and throws
"ES Modules may not assign module.exports" at evaluation time, aborting
the whole client module chain (No such template: swimlane / notifications
/ boardButtons, blank board, missing top bar). This is not an rspack
version regression (the lockfile has pinned ~1.7.x since v8.40); it is
that WeKan added CommonJS helpers to the client bundle.
Convert the 42 client-reachable pure-logic models/lib helpers from
`module.exports = { ... }` to `export { ... }`, and calendarFilter's
internal require('./swimlaneFilter') to an import with a .js extension
(node ESM needs it; rspack/reify tolerate it). Server-only helpers that
use node built-ins (fs/path/child_process) stay CommonJS. The plain-Node
.cjs unit tests for these helpers now use `await import(...js)` (wrapped
in an async IIFE); a source-guard in importVirtualMembers was updated
from module.exports to export. Verified: the full tests/*.test.cjs suite
has the SAME 7 pre-existing failures as before this change and no new
ones.
|
||
|
|
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, |
||
|
|
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,
|
||
|
|
0470adcf3b |
snap wekan.problems: neutral check titles so a failing check does not read contradictorily.
The login-page checks used affirmative titles ("ROOT_URL is set", "A migration or
repair is in progress"), so a FAILING one printed e.g. "[error] ROOT_URL is set:
ROOT_URL is not set" — confusing. Use neutral subjects ("ROOT_URL", "Migration or
repair") so the "[severity] <title>: <detail>" line reads correctly in every state.
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 !
|
||
|
|
0e0391f6c1 |
Fix #6506: restore the import "map members" step; unmapped members become virtual users, not the importer.
Regression from
|
||
|
|
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 ! |
||
|
|
a4460b3f63 |
Fix #6504: rule to move a card to another board failing with "newBoard.getNextCardNumber is not a function".
On the server ReactiveCache.getBoard() is async (returns a Promise). The cross-board branch of Cards.helpers.move() called it without await, so `newBoard` was a Promise: `newBoard.getNextCardNumber()` threw, and `oldBoard` being a Promise silently dropped label carry-over. Await both getBoard() calls (same fix as PR #6505). Added tests/cardMoveAwaitBoard.test.cjs as a regression guard. Thanks to ChristianMa97 and xet7 ! Closes #6505, Fixes #6504, |
||
|
|
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. |
||
|
|
c90d6eaa40 |
Swimlanes: a shared card no longer appears in every swimlane (doubled cards).
In swimlanes view a card with swimlaneId null/'' (a 'shared' / pre-migration card) was surfaced in EVERY swimlane: swimlaneMembershipSelector used { swimlaneId: { $in: [swimlaneId, null, ''] } } for non-first swimlanes, and filterCardsByListAndSwimlane matched null/''/missing there too. On a board with several swimlanes the same shared card therefore rendered once per swimlane -- the reported 'doubled cards/entries', which also bloats the DOM (contributing to the search hang / can't-scroll on big boards). A non-first swimlane now matches ONLY its own cards ({ swimlaneId }); shared and orphaned cards surface ONCE, in the FIRST swimlane (the $nin branch, unchanged), so a card is never shown in more than one swimlane. Still a single field clause, so the #6441 board-wide label-filter fix is preserved (verified in the tests).
Tests: tests/swimlaneFilter.test.cjs updated -- a non-first swimlane matches only its own cards; shared/orphaned cards appear once in the first swimlane and are still filtered by the active label filter; #6441 board-wide filtering for cards that HAVE a swimlaneId is unchanged. 18 checks pass.
Thanks to xet7.
|
||
|
|
191f827393 |
Card links keep working after the card is moved to another board (#4758).
A card URL is /b/:boardId/:slug/:cardId; after the card was moved to another board the link opened the OLD board and found nothing. The card route now resolves the card via the permission-checked 'card' publication (server/publications/cards.js, which only returns the card when the user may see its board) and, if the card's CURRENT board differs from the URL's board, redirects to /b/<currentBoard>/<slug>/<cardId> so the card opens where it now lives -- so a link stays valid across board moves as long as the viewer has access to the destination board (like Trello). When the user cannot see the card's new board (or it is gone) the probe subscription yields nothing and the URL's board is kept, and the redirect is guarded against a redirect loop (target board matches -> stop) and against firing after the user navigated away. The decision is a pure, unit-tested models/lib/cardLinkRedirect.js. (A toast telling the user 'this card was moved to a board you cannot access' in the no-access case is a possible follow-up.) Tests: tests/cardLinkRedirect.test.cjs (6 checks) covers the moved-card redirect, the same-board no-op, missing/invalid card (stay put), the no-loop invariant, and a router source guard that it drives off the permission-checked 'card' publication. Thanks to Robdebert and xet7 ! Fixes #4758, |
||
|
|
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, |