Repository navigation
TSA-267: undo verification ctrl z - #311
Conversation
…ification-ctrl-z # Conflicts: # apps/backend/src/modules/pages/page.controller.ts # apps/backend/src/modules/pages/page.service.ts
There was a problem hiding this comment.
I noticed the confirm → undo → confirm AC cannot really be validated with the current dev mock.
The UI advances after the second confirm, but the DB still keeps the page as transcribed, which matches the known backend issue from #147.
Since #147 is still pending, should this AC remain blocked by that ticket instead of being tested against the temporary mock?
…6-transcripta into feat/TSA-267-undo-verification-ctrl-z # Conflicts: # apps/frontend/src/modules/pages/pages-api.ts # apps/frontend/src/modules/pages/slices/actions.ts # apps/frontend/src/modules/pages/slices/pages.slice.ts # apps/frontend/src/modules/pages/slices/pages.ts # apps/frontend/src/pages/verification/verification.tsx
254eeb6 to
64671b2
Compare
|
After resolving conflicts and merge 'PageStatus' dissapear from import in page.service.ts and causes the error. I don`t now why. But if it happens, just check and fix it. |
…ification-ctrl-z # Conflicts: # apps/backend/src/modules/pages/libs/constants/constants.ts # apps/backend/src/modules/pages/libs/enums/page-error-message.enum.ts # apps/backend/src/modules/pages/page.controller.ts # apps/backend/src/modules/pages/page.service.ts # apps/frontend/src/pages/verification/verification.tsx # packages/shared/src/modules/pages/libs/types/page-undo-response-dto.type.ts
|
I tested it locally and it works correctly.
|

Closes #267
What
Adds the frontend half of #56 —
Ctrl+Zundoes the last page verification and returns the user back to that page,transcribedagain, with its original transcription.Ctrl+Z/Cmd+Zin viewing mode after confirming a page reverts it and moves the cursor back to itrollbackmap ([FE] Roll back the full optimistic state, not just page status #144)Ctrl+Zin the edit box undoes your typing instead ([FE] Undo the last verification with Ctrl+Z #267 AC)Ctrl+Zadded to the shortcuts list on the verification header; it was already in the key map indocs/06-verification-ui.mdWhy
The backend endpoint
POST /pages/:id/undodoes not exist yet (#147). This PR ships a dev-only mock of it (guarded byprocess.env["NODE_ENV"] !== "production") so the flow can be exercised locally until #147 lands. It is therefore not available on the deployed QA environment.What changed
apps/frontend/src/pages/verification/verification.tsx:handleUndo(guards onlastVerifiedPageId,isVerifying,isEditing; rolls back on rejection with a notification)use-verification-keyboard.hook.ts:keydownlistener forCtrl/Cmd+Z(skipsinput/textarea/select/contentEditable,event.repeat)pages.slice.ts/actions.ts:undoPagethunk +undoOptimistic,lastVerifiedPageId,selectLastVerifiedPageId;verification-header.tsxhintsCtrl+Z UndoUndoPageResponseDto({ pageId, status, transcription })POST /api/v1/pages/:id/undoinpage.controller.ts/page.service.ts, reusingDocumentGetPagesTranscriptionResponseDtoHow to test
Local environment only — the mock endpoint is disabled in production.
npm run dev -w apps/backendandnpm run dev -w apps/frontend).undo-mock@test.dev/Password123!(user id 7), only exists in the local database where it was created — it is not part of the seed, so it cannot be reused by someone else's machine. Either sign up your own user or insert rows locally.transcribedpage for that user (through the normal upload pipeline, or seeded locally).confirmedand the cursor advances.Ctrl+Z→ you are put back on that page, it showstranscribedagain with the original transcription.Ctrl+Zwhile typing → it undoes your typing; the page is untouched.Verified
Ctrl+Zputs the user back on that page,transcribedagainCtrl+Zinside the edit textarea undoes typing, not the verificationPOST /api/v1/pages/:id/undo→200with{ pageId, status: "transcribed", transcription }; DB reverts (status→transcribed,verified_by→null)