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
Publish multiple locales #20258
Publish multiple locales #20258
Conversation
* feat(core): document service (un)publish multiple locales * fix(core): cleanup locale param types * feat(content-manager): wip - multiple locale support * Count draft relations across locales (#20116) * feat(content-manager): publish multiple locales from CM route * feat(core): multiple locales in document service discard draft * feat(content-manager): use bulkpublish for locale publish * feat(content-manager): use query from bulkpublish locales * feat(content-manager): publishMany * feat(content-manager): api test for bulk locale + document publish * chore(content-manager): fix for build * fix(core): avoid * in locale data * chore(content-manager): pr amends and validation improvement * feat(content-manager): use transaction in document manager publish many * feat(core): throw when a non string locale is provided and not supported * fix(core): doc service find many * chore: clean up * feat(content-manager): Select fields that require validation in availablelocales (#20156) * feat(content-manager): wip - select more fields in availablelocales * feat(content-manager): wip available locales using entity traversal * feat(content-manager): wip test available locales returns fields with validation * feat(content-manager): test available locales returns fields with validation * fix(content-manager): ensure sensitive info not exposed in available statuses * fix(content-manager): sanitize document metadata available status * fix(content-manager): sanitize document metadata available status at controller level * fix(content-manager): populate only for validatable fields * chore: clean up * chore: clean up * chore: clean up * fix(content-manager): build issues * fix(content-manager): allow null locales * fix(content-manager): history service (#20185) * fix(content-manager): history service * chore(content-manager): clean up * fix: pr feedback * chore: update actions deps * chore: update utility deps * chore: upgrade sentry * chore: upgrade graphql-tools * fix: http-errors ugprade * chore: add fs-extra types where needed * docs(typescript): type system cheat sheet * chore!: remove deprecated verbose option from ts:generate-types * chore: clean up fix(content-manager) correctly count bulk publish results * fix(content-manager): pr feedback and test improvements * feat(i18n): bulk locale publish modal in CM edit view (#20069) * feat(i18n): wip bulk locale publish modal * fix(i18n): wip - fe bulk locale publish * feat(content-manager): multi locale publish, integrate with backend and add basic e2e test * feat(i18n): wip - display validation errors in bulk locale modal * chore: clean up * chore(i18n): design system changes * feat(i18n): display correct status after publish and clean up error messaging * feat(i18n): access onclose from modal body * fix(i18n): selected locale change * fix(i18n): locale table state * fix(i18n): edit view e2e test * chore(content-manager): validation tweak wip * feat(i18n): cover validation cases in i18n e2e tests * chore: clean up * fix(i18n): edit view more document actions disabled state * chore: feedback * fix(i18n): send all params to publish many * fix(i18n): place bulk locale publish 3rd in array * fix(content-manager): validation error extraction * fix(content-manager): pr feedback * fix: build * chore(content-manager): simplify exports * chore(i18n): revert package --------- Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Jean-Sébastien Herbaux <jean-sebastien.herbaux@epitech.eu> Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: 0 B Total Size: 2.52 MB ℹ️ View Unchanged
|
// There will not be a draft and a version counterpart if the content | ||
// type does not have draft and publish | ||
const model = strapi.getModel(uid); | ||
const keysToKeep = [...AVAILABLE_LOCALES_FIELDS, ...validatableFields]; |
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.
how does the validatableFields string[] works on nested schemas? what happens if the root has a "name" field, but a component inside also has a name field?
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.
I think this is covered in this test
strapi/tests/api/core/content-manager/api/document-metadata.test.api.js
Lines 266 to 267 in 4837913
test('Return available locales, including any fields that require validation', async () => { | |
// Create products with different locales with content for every kind of |
Both the product CT and features components have a 'name' string field
strapi/packages/core/content-manager/server/src/services/document-metadata.ts
Lines 230 to 231 in 4837913
const populate = getValidatableFieldsPopulate(uid); | |
const versions = await strapi.db.query(uid).findMany({ |
The populate here becomes
{
name: true,
category: true,
price: true,
features: {
populate: {
},
},
}
The keys of which are used to build keysToKeep
. So getAvailableLocales
returns
{
id: 2,
documentId: "bpd5tcr2mngn2j0e15jjakq9",
name: "prod-fr-draft",
category: "Cat-1-fr",
price: 1,
createdAt: "2024-05-10T11:23:53.441Z",
updatedAt: "2024-05-10T11:23:53.441Z",
publishedAt: null,
locale: "fr",
features: {
id: 2,
name: "Feature 1 fr",
},
status: "draft",
}
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.
Probably not a big deal, but this might return more atteibutes than necessary. But I see!
As discussed, I still feel uncomfortable by coupling bulk actions frontend validation into the document metadata. And I think we would benefit from loading the document metadata asynchronously on the CM, and not returning it on the main entry retrieval requests. But that might be a bit of work, so let's explore first this solution and we can refactor later (famous last words) |
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.
Code looks good, didnt QA though
packages/core/content-manager/admin/src/pages/ListView/components/BulkActions/PublishAction.tsx
Outdated
Show resolved
Hide resolved
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.
some refinement points 🧽
packages/plugins/i18n/admin/src/components/BulkLocaleActionModal.tsx
Outdated
Show resolved
Hide resolved
packages/plugins/i18n/admin/src/components/BulkLocaleActionModal.tsx
Outdated
Show resolved
Hide resolved
packages/plugins/i18n/admin/src/components/BulkLocaleActionModal.tsx
Outdated
Show resolved
Hide resolved
packages/plugins/i18n/admin/src/components/BulkLocaleActionModal.tsx
Outdated
Show resolved
Hide resolved
packages/plugins/i18n/admin/src/components/BulkLocaleActionModal.tsx
Outdated
Show resolved
Hide resolved
22b2996
to
20e066c
Compare
What does it do?
Adds bulk locale publish modal to the CM edit view
Why is it needed?
V5 core feature
Related issue(s)/PR(s)
CONTENT-1903
DX-1335
DX-1364
See:
#20046 (backend)
#20069 (frontend)