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

Unpublish doesn't work for translated documents #56

Open
sciencefidelity opened this issue Jun 10, 2022 · 4 comments
Open

Unpublish doesn't work for translated documents #56

sciencefidelity opened this issue Jun 10, 2022 · 4 comments

Comments

@sciencefidelity
Copy link

Plugin version 0.3.2
Studio version 2.30.1

Behaviour

Once a document is published and translated it is not possible to unpublish because of the references. I changed referenceBehavior to weak and updated previously published documents in Translation Maintenance, this allowed me to unpublisd the referenced document, but not the base language. By choosing Unpublish Anyway the toast gives this error:

An error occurred while attempting to unpublish this document. This usually means that there are other documents that refers to it.
Details
the mutation(s) failed: Document "0fb5807c-c5a0-4c05-8f90-00df3da42df7" cannot be deleted as there are references to it from "drafts.0fb5807c-c5a0-4c05-8f90-00df3da42df7__i18n_cy"

Expected Behaviour

It would be ideal if choosing unpublish on the base language would unpublish the base language and all translations.

@ehwarren
Copy link

Looks as if the maintenance isn't updating the reference to be weak on BOTH the main and translated documents.

I was able to get around this simply by changing references to weak, and then republishing both the main and translated documents, which triggers the "updating i18n fields", which appropriately updates the references.

after this, I was able to unpublish both the base language and the translations.

I don't have the time to open a pull request on this as of right now but perhaps this can point someone in the right direction.

@iainvdw
Copy link
Contributor

iainvdw commented Feb 21, 2023

I've had a similar issue with plugin v1.0.4 and studio v3.0. The issue here seems to be that this plugin creates strong references from and to translated items. Setting referenceBehavior to weak solves this for the translated versions, like @sciencefidelity said. If there are any other strong references pointing to a content item, the base language cannot be unpublished, unless those references are updated to be weak refs as well.

@kapyar
Copy link

kapyar commented Mar 21, 2023

how to change referenceBehavior have the same problem

@Designer023
Copy link

how to change referenceBehavior have the same problem

Add the following option under the documentInternationalization plugin config:

weakReferences: true

e.g.

documentInternationalization({
            supportedLanguages: [
                { id: "en", title: "English" },
                { id: "fr", title: "French" }
            ],
            schemaTypes: ["article", "experience", "project"],
            weakReferences: true // add this
        })

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

5 participants