Repository navigation
feat(visual-builder): show fields disabled when another session changes or deletes their content type (DRFT-927) #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,12 +27,18 @@ export interface EntryFieldLock { | |
|
|
||
| export type EntryFieldLockInfo = Record<string, EntryFieldLock>; | ||
|
|
||
| /** Every reason the parent can turn editing off for a whole entry scope. */ | ||
| export const ENTRY_EDIT_RESTRICTIONS = [ | ||
| "olderVersion", | ||
| "entryLocked", | ||
| "contentTypeUpdated", | ||
| "contentTypeDeleted", | ||
| "unlocalized", | ||
| "unsavedVariant", | ||
| ] as const; | ||
|
|
||
| /** Why the parent has turned editing off for a whole entry scope. */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: this line and the comment on Generated by Claude Code
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair. Leaving it for now to avoid another CI round on a comment-only change. |
||
| export type EntryEditRestriction = | ||
| | "olderVersion" | ||
| | "entryLocked" | ||
| | "unlocalized" | ||
| | "unsavedVariant"; | ||
| export type EntryEditRestriction = (typeof ENTRY_EDIT_RESTRICTIONS)[number]; | ||
|
|
||
| /** The parts that identify a lock scope: entry + locale + variant. */ | ||
| export interface EntryLockScopeParts { | ||
|
|
@@ -121,12 +127,7 @@ export function getEntryEditRestrictionWriteSeq(): number { | |
| return writeSeq; | ||
| } | ||
|
|
||
| const RESTRICTIONS: ReadonlySet<string> = new Set([ | ||
| "olderVersion", | ||
| "entryLocked", | ||
| "unlocalized", | ||
| "unsavedVariant", | ||
| ]); | ||
| const RESTRICTIONS: ReadonlySet<string> = new Set(ENTRY_EDIT_RESTRICTIONS); | ||
|
|
||
| /** Narrows a value from the parent; anything unknown is treated as "no restriction". */ | ||
| export function toEntryEditRestriction( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the cases now come from the list this test is checking, so the test no longer pins that list's membership on its own. Drop a value from
ENTRY_EDIT_RESTRICTIONSand this block runs one case fewer and stays green, where the hardcoded array it replaced would have failed.Most of that gap is covered elsewhere.
ENTRY_RESTRICTION_MESSAGESis typedRecord<EntryEditRestriction, string>, so a removal that leaves the message behind is an excess-property error at compile time. Only removing the value and its message together slips past both, and that is a deliberate edit rather than a slip.I would take this as it stands. The duplication it removes is worth more than the oracle it gives up. Flagging it so the tradeoff is on the record rather than implied.
Generated by Claude Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, keeping it as is.