Skip to content
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 'instructions for publishers' to Content Block schema #2970

Closed
wants to merge 1 commit into from

Conversation

Harriethw
Copy link
Contributor

@Harriethw Harriethw commented Nov 8, 2024

https://trello.com/c/eilOXzrP/677-add-instructions-to-publishers-to-add-edit
We want to add a field to all Content Blocks that will be a short string containing an internal-only message.

As this is a Content Block specific field, it doesn't necessarily make sense to add it to the shared default-format, so if I understand the schema process correctly we can only add it to the details key.

I think we have a couple of options:

  1. (this PR currently) we add instructions_for_publishers to the details object - nothing more would need to be done, at least until we start rendering more complicated blocks. We currently only look for the email_address key to get block content. But it could be a concern later down the line that the field would accidentally be made available on the frontend? Maybe it could be nested under another key like internal_metadata? It also causes complications on the frontend when rendering (TBC)

  2. we could use the existing description top level key on schemas. I think this could be a bit confusing for devs later down the line though, and I think description might be subtly different for other documents. But it would be cleaner and mean all content blocks would automatically get the field. Also less possibility of it being rendered on the frontend.


⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

We want to add a field to all Content Blocks that
will be a short string containing an internal-only
message.

This adds the field `instructions_for_publishers`
to a shared definitions file, and then uses it in
the email and postal address schemas.

As this is a Content Block specific field, it
doesn't necessarily make sense to add it to the
shared default-format, so if I understand the
schema process correctly we can only add it to the
details key.
@Harriethw Harriethw force-pushed the content-modelling/677-internal-instructions branch from 391b0f2 to 3e11be8 Compare November 8, 2024 11:41
@Harriethw Harriethw marked this pull request as draft November 8, 2024 11:44
@@ -10,6 +10,9 @@
type: "string",
format: "email",
},
instructions_for_publishers: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems a bit annoying that we have to add this every time for each type, but not sure there's a way round it?

@Harriethw
Copy link
Contributor Author

closing this as putting the field in details caused a cascade of problems on the frontend.. we are assuming in multiple places that the details contains the custom fields shown on the frontend for a block, so putting shared metadata doesn't really make sense...

@Harriethw Harriethw closed this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant