enhancement
major
minor
defect
critical
major
minor
major
#30061
React UI: recent changes of the user with revert of a commit (user menu)
Split off #30047. Follow-up to #29767, related: #29108.
Context
The classic UI offers "My latest changes" (com.top_logic.model.search, admin/myLatestChanges/*): the user's own last commits with their changes and the revert of a commit. The React UI has the change-set table of Administration → Monitoring → Changes and its details dialog (admin/monitoring/revision-details.view.xml), but no per-user view and no revert.
Feature
The user menu of the React UI gets the entry "My latest changes": a dialog listing the current user's last 30 commits (revision, date, message, whether the commit is reverted). Activating a commit opens its details; there it can be undone ("Undo change") or, once undone, redone ("Redo change"). The same commands are available in the details of Administration → Monitoring → Changes. After a revert the details close and the list is recomputed.
Solution
- Shared revert logic (com.top_logic.element, ChangeSetReverter): revertTarget(ChangeSet) follows the chain of reverts of a commit (commit → undo → redo → undo …) to its end, the change set currently in effect, so that a toggle never reverts a change set twice; revert(KnowledgeBase, ChangeSet, force) reverts it in a transaction of its own and rolls back on conflicts unless forced; isUndone(ChangeSet) tells whether the end of the chain is an undo. The classic commands RevertCommandHandler, UndoCommandHandler and RedoCommandHandler use it.
- Change log (ChangeLogBuilder): a redo is linked as revertedBy of the undo it reverts (so far only an undo was linked to its original). The prefix "Reverted: …" is shown only while a commit is undone, no longer after it has been redone.
- TL-Script function changeSetUndone(changeSet) (com.top_logic.model.search): whether a commit is undone in the current state. Decides which of "Undo change" / "Redo change" is offered and the column "Reverted" - in the React views and in the classic "My latest changes", which so far offered "Redo change" again for a commit that had already been redone.
- View action <revert-change-set> (com.top_logic.layout.view): reverts the commit it gets as input. On conflicts with later commits (option check-conflicts, default on) the revert is rolled back and the conflicts are listed in a confirmation dialog; it is applied only on confirmation. Documented in the developer article view-layer/commands.
- Views: admin/monitoring/revision-details.view.xml gets the commands "Undo change" / "Redo change"; it writes a channel reload that the openers (revision-monitor.view.xml, recent-changes.view.xml) bind into it to recompute their table. recent-changes.view.xml is the dialog "My latest changes" (changeLog() filtered by the current user); user-menu.view.xml opens it from the group account.
Verification
tl-demo-react (/view/, root / root1234): edit an object, open the user menu → My latest changes, open the commit, undo it, redo it, undo it again; a conflicting later change of the same attribute leads to the confirmation dialog listing the conflict. Tests: TestChangeSetReverter.