Add steward copy-context and per-type duplicate URL exemption#597
Merged
Add steward copy-context and per-type duplicate URL exemption#597
Conversation
The steward submissions queue gains a copy-icon button on each card (steward review view only) that copies a compact AI-ready bundle of the submission: user, contribution type, mission, state, submitter notes, evidence, staff reply, proposal, and steward CRM notes. Notes are re-fetched on click; copy aborts on fetch failure rather than producing a clipboard payload with silently-missing context. Evidence URL types gain an admin-editable allow_duplicate flag. When set, URLs of that type are exempt from duplicate detection in both the synchronous submission serializer and the auto-review deterministic rule. Accepted-contribution evidence copying preserves the url_type FK so the exemption applies on the converted side; the auto-review path falls back to URL pattern detection when a row's url_type is null. ## Claude Implementation Notes - backend/contributions/models.py: Adds allow_duplicate BooleanField (default False) on EvidenceURLType. - backend/contributions/migrations/0055_evidenceurltype_allow_duplicate.py: Schema migration for the new field. - backend/contributions/admin.py: Surfaces the flag in EvidenceURLType admin list (display, filter, list_editable). - backend/contributions/url_utils.py: check_duplicate_url short-circuits when the incoming URL maps to a permissive type, and excludes stored evidence whose url_type is permissive from both submission and accepted-contribution lookups. - backend/contributions/management/commands/review_submissions.py: _build_url_lookup excludes permissive evidence from url_to_sub_ids and accepted_urls. _check_single_url_duplicate short-circuits when the new evidence's url_type is permissive, with a detect_url_type fallback when url_type is null. - backend/contributions/views.py: Steward-accept evidence copy via bulk_create now preserves url_type so the FK isn't dropped (bulk_create bypasses Evidence.save()). - backend/contributions/tests/test_url_utils.py: Adds CheckDuplicateUrlAllowDuplicateTests and CheckDuplicateUrlNullUrlTypeTests. - backend/contributions/tests/test_review_submissions.py: Adds RuleDuplicateUrlAllowDuplicateTest covering lookup exclusion, per-URL short-circuit, null-fallback, accepted-evidence preservation, and that non-permissive types still reject duplicates. - frontend/src/components/SubmissionCard.svelte: Adds copy-context button gated on showReviewForm && !isOwnSubmission, copyContext() builder that assembles a compact text payload, and onRequestNotes prop so the card awaits a fresh notes fetch before copying. - frontend/src/routes/StewardSubmissions.svelte: Adds throwing fetchNotesForCopy wired as onRequestNotes so fetch failures abort the copy instead of silently degrading.
e5196f7 to
b3c3a6a
Compare
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.
Summary
Test plan