-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add A Model For Timeline Elements #11011
Conversation
First, renamed the `TimelineEvent` type used by timeline atoms to `TimelineAtomEvent` to avoid confusion. Then removed the now-unused `TimelineBlockElement` and replaced it with `FETimelineBlockElement`, to represent the new element coming from frontend, and `DCRTimelineBlockElement`, to represent the parsed/enhanced version in DCR. The DCR version is stricter than the one coming from frontend, enforcing the following rules: - Timeline events must have a date - Timeline sections must have a title - Timelines with one section should be flattened into a single list of events Finally, added an enhancer module for timelines to convert from the frontend type to the DCR one.
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
Size Change: +371 B (0%) Total Size: 762 kB
ℹ️ View Unchanged
|
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.
Strictly accurate
| FETimelineBlockElement | ||
| DCRTimelineBlockElement |
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.
Can it really be either? Once an FETimelineBlockElement
is enhanced, it will either result in nothing or a DCRTimelineBlockElement
…
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.
No, it can't. There are several elements in this model that can only exist in DCR, and replace the frontend elements that they're enhanced from. We should really split it into two models: one for frontend data, and one for DCR data once it's been parsed/enhanced.
Seen on PROD (merged by @JamieB-gu 8 minutes and 47 seconds ago) Please check your changes! |
First, renamed the
TimelineEvent
type used by timeline atoms toTimelineAtomEvent
to avoid confusion.Then removed the now-unused
TimelineBlockElement
and replaced it withFETimelineBlockElement
, to represent the new element coming from frontend, andDCRTimelineBlockElement
, to represent the parsed/enhanced version in DCR. The DCR version is stricter than the one coming from frontend, enforcing the following rules:Finally, added an enhancer module for timelines to convert from the frontend type to the DCR one.
Part of #10869. See guardian/content-api-models#245 for the proposed CAPI model.