-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
chore(content-releases): releases migration to v5 #20259
base: v5/main
Are you sure you want to change the base?
Conversation
* chore: migrate bulkDelete to v5 * chore: change findLocales type to accept strings array * fix: docs prettier styles * chore: remove console.log
…into v5/bulk-publish-unpublish
packages/core/content-releases/server/src/controllers/release.ts
Outdated
Show resolved
Hide resolved
This comment was marked as spam.
This comment was marked as spam.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
* fix(content-releases): refactor relation with entries * fix(content-releases): refactor relation with entries * fix(content-releases): lint & unit tests errors * fix(content-releases): add migration for releases actions coming from v4 * fix(content-releases): apply multiple suggestions * fix(content-releases): new test data for e2e tests * fix(content-releases): fix test data * fix(content-releases): handle edge cases * fix(content-releases): apply marc suggestions
@@ -103,46 +54,11 @@ export const bootstrap = async ({ strapi }: { strapi: Core.Strapi }) => { | |||
}); |
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.
this lifecycle is blocking , is it necessary? Maybe we can make this asynchronous so it doesnt slow down deleeteMany ops
await strapi.db.query(RELEASE_ACTION_MODEL_UID).deleteMany({ | ||
where: { | ||
target_type: model.uid, | ||
target_id: { | ||
$in: (entriesToDelete as Array<{ id: Data.ID }>).map((entry) => entry.id), | ||
}, | ||
contentType: model.uid, | ||
locale: where.locale ?? null, | ||
...(where.documentId && { entryDocumentId: where.documentId }), |
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.
could this create a recursive infinite loop? (deleteMany triggering this same lifecycle)
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.
It's a good point, honestly never thought about that. But you can see at line 15 that this subscriber is added only for D&P ContentTypes, and ReleaseAction doesn't has D&P, so the subscriber is not registered for it
const query: GetReleases.Request['query'] = await permissionsManager.sanitizeQuery(ctx.query); | ||
const { results, pagination } = await releaseService.findPage(query); |
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.
shoulndt this endpoint also need a yup validation?
return next(); | ||
} | ||
|
||
if (!ctx.contentType.options?.draftAndPublish) { |
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.
could you use the following @ strapi/utils
utility to check this?
if (!ctx.contentType.options?.draftAndPublish) { | |
import { contentTypes } from "@ strapi/utils" | |
if (contentTypes.hasDraftAndPublish(ctx.contentType) { |
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.
overall approach lgtm ! :) only added minor comments
What does it do?
Migrates and apply new changes on the Content Releases plugin for v5.
Work to do