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

Duplicated documents upload to the same folder #201

Open
thompsonsj opened this issue Oct 21, 2024 · 0 comments
Open

Duplicated documents upload to the same folder #201

thompsonsj opened this issue Oct 21, 2024 · 0 comments

Comments

@thompsonsj
Copy link
Owner

thompsonsj commented Oct 21, 2024

Consider how to resolve the issue of duplicated localized documents uploading to the same folder on Crowdin.

This is resolved in your Payload installation by adding an appropriate logic in a beforeDuplicate hook:

const beforeDuplicate: BeforeDuplicate<LandingPage> = ({ data }) => {
  return {
    ...data,
    // prevent this landing page from localizing to the same folder on Crowdin
    ...(data.crowdinArticleDirectory && {
      crowdinArticleDirectory: null,
    })
  }
}

Expecting the user to modify their configuration is not ideal. I can currently think of two better possibilities:

  • Can beforeDuplicate be defined as an array? Seems to be an object so hooks cannot be merged. Change to Payload CMS?
  • Modify plugin behaviour to no longer modify existing documents. Details as follows.

This could be resolved if we move to a version of this plugin that doesn't modify the original document (i.e. we store data in our own collections - we don't modify existing documents by adding a crowdinArticleDirectory relationship field). In this case, CrowdinArticleDirectorydocuments will link to a specific document. When duplicated, a document will have a new id so this will no longer be an issue.

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

No branches or pull requests

1 participant