#47: link existing covers ↔ existing markings from the detail pages#84
Merged
Conversation
Editors can now relate records that already exist, instead of only attaching brand-new covers to the one marking being viewed: - RecordDetail: "Link Existing Cover" dialog (ID or C-42 code) POSTs the existing cover-markings endpoint and refreshes the associated list. - CoverDetail: "Link Existing Marking" dialog, same endpoint, refreshes associated markings + the review link. - Both buttons are gated to editor/admin (isStaff) to match the endpoint's IsEditorOrAdminWrite permission. - ID parsing extracted to lib/recordLinking with unit tests. Ported by hand from the pre-refactor reese/cover-workflow-improvements branch (7ae724a); image-move parts of that branch land separately (#48). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Code review overview
Syntax ErrorsNo issues found. Code Smells1. Duplicated handler logic (
2. Inline error-shape cast repeated in two files
3. Four parallel state variables per feature
4. Missing blank line before
Bugs1.
2. Stale
3.
4. No test coverage for
Security Vulnerabilities1. API error detail displayed directly in the UI
2. Client-side staff check is the only UI gate for "Link" buttons
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Michael's ask: "relate an existing cover to one or more existing markings, and relate an existing marking to one or more covers. Currently you can only add entirely new covers and they're assigned to the one marking."
42/C-42), verifies it viagetCoverById, POSTs the existingcover-markingsendpoint, and refreshes the Associated Covers list in place. Duplicate/validation errors surface in the dialog.getMarkingById+createCoverMarking.lib/recordLinking.tswith unit tests.Gating decision
Both buttons render only for editor/admin (
isStaff). The endpoint isIsEditorOrAdminWrite, so a contributor-visible button would just 403 on submit — frontend now matches the backend's permission. If we want contributors linking covers, that's a backend permission change to make deliberately, not a UI default.Zero backend changes
CoverMarkingViewSet+createCoverMarkingalready shipped; this is UI plumbing only. Ported by hand from the pre-refactorreese/cover-workflow-improvementsbranch — the image-move half of that branch lands separately as #48.Tests
jest 53/53 (12 suites, +4 new for ID parsing),
tsc --noEmitclean, eslint clean, vite build clean.🤖 Generated with Claude Code