Repository navigation
Feat(UI): Disclaimers for "Variant" and related changes - Large Change - #534
Open
Aditya-Dawadikar wants to merge 8 commits into
Open
Aditya-Dawadikar wants to merge 8 commits into
Aditya-Dawadikar wants to merge 8 commits into
Conversation
Move the disclaimer picker into a reusable DisclaimersField and gather the labels and banner copy in lib/disclaimers, keyed by the shared DisclaimerSlug so a new slug can't ship without a label. Drop the duplicated slug lists in contributions.ts and guideRevisions.ts in favour of @bluelearn/schemas. Prep for adding disclaimers to the variant creation form (bluelearn-org#520).
…pproval Disclaimers are now proposed per revision, like subject tags, instead of being written straight onto the guide base. A new guide_revision_disclaimers table holds each revision's set. A trigger starts every new revision from its base's current disclaimers, and close_review_panel copies the approved revision's set onto the base. Forks of a rejected revision keep the disclaimers it proposed. This drops the 422 that blocked disclaimer edits on published guides, so edits made in a guide revision now show up once it is approved. The variant creation form gets the shared DisclaimersField, filled in from the selected base guide. createVariantSchema accepts an optional disclaimers list, leaving it out keeps the base guide's set.
…edits The review case now returns its revision's disclaimers, so reviewers see the banners the guide will carry. Revision diffs compare the two revisions' disclaimer sets as added / removed / unchanged, and the Changes view shows them, the first version of a guide lists all of its disclaimers as added. The edit form's no-change check now counts disclaimer edits, so a guide or variant revision that only changes disclaimers can be submitted.
Aditya-Dawadikar
marked this pull request as ready for review
October 31, 2026 06:15
Aditya-Dawadikar
requested review from
andyrodrigues30 and
tonylam0
as code owners
October 31, 2026 06:15
Contributor
|
@Aditya-Dawadikar Well done but there's one bug- Your code changes disclaimers of the base guide whenever a variant is created with additional disclaimers, The base guide should not be affected by a variant creation. |
Contributor
Author
let me take a look. thank you for taking your time out to review this huge PR |
the reviewer can now see the disclaimers.
Contributor
Author
GuideReader now renders the disclaimer banner, but the guide and variant pages still drew their own above it, so each disclaimer showed twice. Drop the page-level banners and let GuideReader render it everywhere.
…inal guide. now each variant stores its own set of disclaimers and schema is modifed accordingly. added regression tests to add/remove a disclaimer without touching the original guide.
This branch has not been deployed
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
Fixes #520.
Disclaimers could not be set when creating a variant. Disclaimer edits in a guide revision were never applied when the revision was published. Reviewers couldn't see disclaimers, the Changes view didn't show them, and a revision that only changed disclaimers was rejected as "no changes".
The root cause was that disclaimers were written straight onto the guide base rather than proposed on the revision. On a published guide that write was blocked, so there was nothing to review or publish.
Revision-scoped disclaimers
guide_revision_disclaimerstable, with RLS: anyone can read; only the author of a draft can change it. Each revision now proposes its own disclaimer set, like subject tags.close_review_panelreplaces the base's disclaimers with the approved revision's set. Rejected revisions leave the base untouched.revise_guide_revisioncarries the rejected revision's disclaimers into the new draft.createGuide,addGuideVariantandupdateRevisionnow save disclaimers on the revision. This removes the 422 that blocked disclaimer edits on published guides.Variant creation
DisclaimersField, filled in from the selected base guide. If lookups resolve out of order, the latest pick wins.createVariantSchemaaccepts an optionaldisclaimerslist; leaving it out keeps the base guide's set.Review and Changes view
GET /reviews/cases/:idreturns the revision's disclaimers, and the review page shows their banners.disclaimersset diff (added/removed/unchanged).RevisionDiffshows it as a Disclaimers row.Disclaimer-only edits
isRevisionDraftUnchangednow compares disclaimers, ignoring order, so a guide or variant revision that only changes disclaimers can be submitted.Refactor
DisclaimersField. Labels and banner copy live inlib/disclaimers, keyed byDisclaimerSlug. The duplicated slug lists were replaced with the ones from@bluelearn/schemas.Note: revisions approved before this migration were backfilled with the base's current disclaimers. Diffs between those older revisions will show disclaimers as unchanged.
Edit 1
Type of change
Verification
pnpm -r typecheckpassespnpm -r buildpasses