Share bounded admin translation services between the modern and HTML4 views, keep literal search selectors server-owned, block and report direct DDP writes, and provide complete semantic create, edit, search, paging and confirmed-delete controls. Verify both views on the same live route and keep their 25-row counters aligned.
Share bounded, card-scoped comment creation, editing and deletion between Meteor and cookieless HTML4. Enforce assigned-board and author/admin policy, report boundary probes, preserve activity history, and require a signed two-step delete confirmation.
Add a shared labelled select component and an authoritative card placement operation used by Meteor and cookieless HTML4. Reject foreign or archived destinations, compute ordering server-side, and verify list movement and refusal at the same card URL.
Share authorized title, description, archive and restore operations between Meteor and signed cookieless HTML4 forms. Validate linked targets and descendant trees before writes, report refused cross-board attempts with actor details, and verify both views at the same card URL.
Share authorized card creation and deterministic up/down ordering between Meteor and signed cookieless HTML4 forms. Keep controls labelled and keyboard ordered, reject forged cross-board placement, and cover both representations with same-route browser screenshots.
Reported as "when I try to restore card description from card history, it
restores wrong history, that I did not select" - and the selection was never
wrong. The server restored exactly the row whose checkbox was ticked. It
applied the wrong half of it.
A row carries two contents, before and after. The History table shows the
AFTER - History.md 7 says the content column holds "the new text" - and
Restore applied the BEFORE, because it reused the undo path: `applyRow(row,
'undo')`. So choosing the row that displayed the description you wanted handed
you the description from the row above it, and choosing rows one after another
walked backwards through the history instead of moving through it.
Restore now has a direction of its own. The rule is one sentence: the row a
reader picks and the value they get are the same thing. A row with no new
content is a removal, so restoring one puts back what it removed.
Undo is deliberately the other way round - Ctrl+Z reverses your own last
change - and is unchanged. The two only agree when the row you pick happens to
be the last one, which is why this survived the first pass: the live check
restored a title that WAS the most recent change, so undo and restore gave the
same answer.
The rule moved into `contentForDirection` in models/lib/changeHistoryGroups.js
so it can be tested as arithmetic, with no server and no database, and so
applyRow and the restore method cannot drift apart.
A restore is itself recorded, and those rows were wrong in the same way: they
repeated the restored row's own before/after, which describes a different
change. The live value is now read BEFORE the write and recorded as what was
displaced, so restoring FIRST over THIRD says so.
Verified against a running server: three description versions, FIRST, SECOND,
THIRD, with THIRD current. Picking the row showing FIRST set the description
to FIRST and logged THIRD -> FIRST; then picking SECOND set it to SECOND and
logged FIRST -> SECOND. Before this, picking FIRST emptied the description.
tests/historyRestoreAppliesWhatIsShown.test.cjs pins the rule from both ends -
what restore applies, and that the table shows that same content - along with
removals, additions and junk input. tests/changeHistoryWiring.test.cjs pinned
the old inline ternary by its text; it now runs the rule instead, which a move
like this cannot break.
Thanks to xet7 !
The change history and its table were written without a Meteor runtime
available, and both documents said so. Opening it found four things that no
amount of reading the source would have shown, three of which made the
feature useless.
THE TABLE WAS BLANK. `{{#each row in rows}}` binds `row` as a NAME and leaves
the data context alone - unlike `{{#each rows}}`, which replaces it - so
`{{_id}}`, `{{contentSummary}}` and the rest resolved against the OUTER
context and rendered nothing. Nothing errors: the table drew one row of four
empty cells and a checkbox with no id. Same bug in the contributor loop. Every
field now goes through its loop variable.
THE ROW COULD NOT BE SELECTED. WeKan hides every bare checkbox app-wide -
forms.css: `[type="checkbox"] { display: none }` - and draws `.materialCheckBox`
divs instead, so the real one here rendered 0x0. The row was visible, could
never be ticked, and Restore stayed disabled with nothing that could enable
it. It is now the control the rest of the app uses, clicked rather than
changed, drawn from the selection state.
THE PANEL WAS 380px WIDE. A popup's default width left 129px for the
contributor pane and 201px for a four-column table; the search box was
squeezed to 32px and one row had to be scrolled sideways to be read. History
is the same shape as the export panels - two panes, opened from a menu at the
edge of the screen - so it joins them in popup.css and in the FULL_WIDTH_POPUPS
list in popupOffset.js, which is the other half that decides where a panel is
placed. The rows also scroll in a wrapper now rather than in the table itself:
`display: block` on a <table> stops the cells sharing column widths, so the
header and the rows beneath it drift apart.
AND A RESTORE WAS RECORDED TWICE. This one is a correct decision with a
consequence: History.md 8.2 says a restore re-applies content through the
SAME setters an ordinary edit uses, so validation, hooks and Activities all
still run. The field-diffing after.update hook is one of those hooks, so it
saw the restore's own write and recorded it - and restoring a title left an
`edited` row nobody made sitting above the `restored` row describing the same
write. Recording, and only recording, is now switched off for the duration of
the applier.
That switch is an AsyncLocalStorage scope, not a module-level boolean, and the
difference is not stylistic: the server handles several requests at once, and
a shared flag set during one user's restore would have silently swallowed
another user's edit landing in the same window - a data-loss bug that appears
only under concurrency and would never be seen in testing.
Verified against a running server rather than by reading: a card renamed
through the UI recorded one row with the right group, previous and new value;
History showed it; selecting it and pressing Restore put the title back and
left exactly two rows, the edit and the restore.
tests/historyOneTemplate.test.cjs pins the loop-variable rule, the checkbox
control, the panel width in both files that decide it, and the scroll wrapper.
tests/historyRestoreRecordsOnce.test.cjs pins the suppression, that a restore
still writes through the normal setters, and - running two overlapping async
operations for real - that a concurrent edit by another user is still
recorded.
Thanks to xet7 !
Phases 3, 5 and 6 of docs/Features/Reports/History/History.md, and the viewer of
phase 2.
RECORDING EVERYTHING, FROM ONE PLACE. §5 suggests "a thin, central choke point
... avoids sprinkling calls everywhere", and server/models/changeHistoryHooks.js
is that: an after.update hook per collection that diffs the changed fields, plus
insert/remove for the sub-entities. Cards, lists, swimlanes, checklists,
checklist items and comments are covered across every group §3 names.
The advantage over editing twenty setters is not brevity, it is COVERAGE: the
REST API, the CSV and Trello importers and the rules engine all write through
the collection and none of them call the client setters, so a per-setter rollout
would have recorded a description edited in the UI and silently missed the same
edit made over the API.
What a hook must not do is record too much, so models/lib/changeHistoryGroups.js
is a table rather than a rule: modifiedAt and dateLastActivity change on nearly
every write and would bury the changes a person actually made, and the four
fields of a move only mean anything together - reported separately, one drag
becomes four rows and undo puts back a quarter of it. Card.move and the list
soft delete therefore record themselves, as one change each. The description
setter records nothing now: the hook covers it, and recording in both places
would have needed two presses of Ctrl+Z to undo one edit.
ONE TABLE, EVERY SCOPE. §7a: "there is ONE implementation, parametrised by
scope". client/components/history/historyTable is that one - contributor pane,
search, pagination, row selection, Restore, RTL - and the card, list and
swimlane menus each open it with a different scope. Adding History to a menu is
a menu item and a two-line handler, exactly as the design promises.
tests/historyOneTemplate.test.cjs keeps it that way. Six copies of a table
drift: one gets RTL and the others do not, one gets the search fixed and the
others keep the bug. The test walks every .jade under client/ and fails if a
second History table is ever defined.
Two things the UI needed that were nearly wrong. The scope has to travel as
`dataContextIfCurrentDataIsUndefined`, because Popup.open's second argument is
OPTIONS - a bare object there is ignored and the popup opens on the menu's own
data context, showing the wrong history. And the popup needs a title key or it
renders with no header and no close button; it reuses the existing `history`
key rather than adding one.
FOUR NEW WORDS. Removed, Edited, Moved, Restored - the Action column is the one
a reader must understand. 'Added' the app already had, and every other label
reuses the word the card view already uses for that section, so a group is
labelled Description or Labels in the language the card beside it speaks. That
kept this to four keys in 197 locales instead of twenty-six. Low confidence on
the same long tail as before.
NOT VERIFIED LIVE. There is no Meteor runtime here, so none of this has been
opened in a browser. §10 asks for each phase to be verified live before the
next; that has not happened, both documents now say so, and the UI in
particular should be treated as unproven.
Thanks to xet7 !
Phase 1 of docs/Features/Reports/History/History.md §10, plus the write half of
phase 2. Ctrl+Z is no longer a position-only feature.
THE STORE. models/changeHistory.js is the append-only collection of §4: one row
per change, carrying every container id it sits inside (boardId, swimlaneId,
listId, cardId) so a container scope is a plain equality rather than a join the
database cannot do - which is what makes a swimlane's history include its lists'
and cards' rows.
It imports NO other model, deliberately. Its predecessor imports Cards, Lists,
Swimlanes, Checklists and ChecklistItems so its undo() can write to them, and
that is precisely why models/cards.js could not import it, guarded on an assumed
global instead, and recorded nothing for years. A collection that entities must
import cannot import entities. Applying a change back to a document therefore
lives in server/models/changeHistory.js, which nothing imports and which may
import anything.
THE RULES ARE PURE. models/lib/changeHistoryQuery.js holds the scope-to-selector
translation, the search and the selection normalisation, with no Meteor and no
database, because that is where this feature is either right or quietly wrong:
a scope that resolves to the wrong id column shows one board's history under
another board's menu, and a selection that does not normalise its input restores
the wrong rows. Both are silent. 17 tests, including that an unknown or
half-given scope is REFUSED rather than widened into a selector that matches
everything.
UNDO IS NOW THE WHOLE HISTORY. changeHistory.undoLast/redoLast replace the
position-only methods; the keyboard bindings and the tested pickUndo/pickRedo
rule are unchanged. One rule covers every change type instead of a case per
action: undo applies previousContent, redo applies newContent. Restores go
through the same setters an ordinary edit uses, so validation, hooks and
Activities still run, and each restore is itself recorded twice - once
attributed to whoever made the change being restored, once to whoever pressed
Restore (§8.3).
RECORDED SO FAR: card description edits (§10.2's first content group - the
previous text is read BEFORE the write, since after it the old value is gone),
card moves, list moves, and list soft-delete/restore, which is what makes
"undo a deleted list" work.
changeHistory is in the snap's MERGE_COLLECTIONS, as §9a.4 requires the moment
the collection exists: a history row written on the copy that is not served is
work that would otherwise be stranded in a database nobody opens.
NOT BUILT: every UI in §7, §7a and §8 - the popup, the table, the contributor
avatars, the Restore button, the "History" menu items - and recording for the
remaining groups of §3. The methods those screens need exist and are tested;
nothing calls them yet. Both docs now say which half is which, because the last
time this document claimed more than the code did, the gap survived for months.
Thanks to xet7 !
Ctrl+Z after dragging a card did nothing, and had never done anything.
#6478 found that every trackChange call site guarded on
typeof UserPositionHistory !== 'undefined'
against a bare identifier no file imported. It is an ES-module default export,
not a global, so the guard was always false and nothing was ever recorded. The
fix - import the collection - was applied to the list path in
server/models/lists.js and NOT to the card path in models/cards.js, which kept
the dead guard. So list moves became undoable, card moves did not, and
docs/Features/Login/Undo/Undo.md said card moves were "already present (now
actually runs)" the whole time.
The import here has to be lazy and has to be inside the call:
models/userPositionHistory.js imports models/cards.js, so a top-level import
would be a cycle and could leave the binding undefined depending on evaluation
order. That is the same shape as the cardMoveModifier require a few lines above,
and is most likely why the file was skipped rather than fixed.
The guard is gone from the list path too. It was harmless there - that file does
import the collection, so it was always true - but it is the shape that turned
recording off, and copying that block into a file without the import silently
turns it off again. Which is exactly how the card path stayed dead.
tests/undoRecordsWhatItClaims.test.cjs is the guard the fix needed more than the
fix itself, because undo FAILS SILENTLY: nothing throws when a change is not
recorded, the user just presses Ctrl+Z and nothing happens. It finds the
recording sites rather than listing them, and fails when one cannot reach the
collection, when one reintroduces the assumed-global guard, when recording is
not wrapped so it can never fail the move it records, and when an entity type is
recorded that undo() has no case for. It also pins the reverse gap - swimlane,
checklist and checklistItem have full undo() cases that nothing records - so
that stays a known follow-up rather than a surprise.
Undo.md no longer claims more than the code does, and now says plainly what is
recorded (list moves, list soft-delete/restore, card moves) and what is not
(everything else - a description, a checklist title, labels, members, dates are
written straight to the document with no previous state kept).
Thanks to xet7 !
Moving a list to another swimlane on the same board did nothing: the list kept
its empty swimlaneId, so it went on rendering under every swimlane, and
deleting "the one in the second swimlane" deleted the only list document there
was. Backups showed the empty swimlaneId the report describes.
List.move(boardId, swimlaneId) asked "does the target board already have a list
with this name?" without first asking whether the target board IS this list's
board:
const boardList = await ReactiveCache.getList({
boardId, title: this.title, archived: false });
if (boardList) { ...merge, never writes a swimlaneId... }
else { ...insert a new list WITH the swimlaneId... }
On a same-board move that search finds THIS LIST, so the merge branch ran - and
the merge branch is the one branch that never writes a swimlaneId. The chosen
swimlane was discarded every time, which is why the binding could not be
restored by hand either.
Merging is only meaningful across boards. On the same board a move is a
re-bind, so that is what it does now. The decision lives in
models/lib/listMovePlan.js, where it can be unit-tested, and models/lists.js
applies it: same board -> rebind this list, other board with the name taken ->
merge the cards into that list, other board -> create it there, bound. An empty
swimlaneId stays a deliberate un-bind back to board-wide, which is still a
legitimate layout. moveList now also refuses a swimlane that is not on the
board the list is moving to.
The same branch called `card.move(boardId, this._id, boardList._id)`, and
Card.move's second argument is a swimlaneId - so it set every card's swimlaneId
to a LIST id, i.e. to a swimlane that does not exist, and those cards became
the orphaned cards the board-open repair then has to rescue. The cards were
also selected as `this.cards(swimlaneId)`, filtering the SOURCE list's cards by
a swimlaneId belonging to the TARGET board, which on a cross-board move matches
nothing and left every card behind. Both are gone: the list's own cards travel
with it, into the chosen swimlane.
A negative test scans models/lists.js for any card.move() whose second argument
is not a swimlane, so this cannot come back at another call site - it found the
argument order was wrong in only this one place, and the scan now ignores
comments so the explanation of the fix does not trip it.
This does not restore bindings already lost. Boards opened under the versions
before #6515 had every list un-bound automatically, and which swimlane each
list belonged to is not recoverable from the data; with this fix that binding
can at least be set again from Move List.
Thanks to TawsTm and xet7 !
Fixes#6670,
Keep service-specific values on the server, never publish passwords to the browser, and let the administrator opt out of MAIL_URL in favor of Nodemailer's bundled SMTP service profiles. Add unit, negative, publication, and browser coverage.\n\nThanks to xet7 !