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

Stop translations from being automatically published when source is in draft state #511

Conversation

AndrewCalderSpringload
Copy link
Contributor

@AndrewCalderSpringload AndrewCalderSpringload commented Jan 27, 2022

Stop translations from being automatically published when source is in draft state

The publish parameter of Translation.save_target() defaults to True.

When save_target() is called by TranslationCreator.create_translations(), translations were saved in a live state even if a source page was in draft (live is False).

create_translations() now uses a page's live attribute to determine whether a translation of that page should be published when calling save_target().

If for some reason that value can not be determined, a value of True is applied to preserve existing behaviour.

Fixes #553

@zerolab
Copy link
Collaborator

zerolab commented Jan 27, 2022

Hey @AndrewCalderSpringload, thank you for this PR.

I do wonder whether it makes more sense to prevent sending a page for translation via the UI if the page is only a draft. In many cases, being only a draft means it is likely not ready. What is your use case?

@zerolab
Copy link
Collaborator

zerolab commented Feb 17, 2022

@AndrewCalderSpringload any thoughts on the above?

@AndrewCalderSpringload
Copy link
Contributor Author

AndrewCalderSpringload commented Feb 18, 2022 via email

Copy link
Collaborator

@chris48s chris48s left a comment

Choose a reason for hiding this comment

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

Sorry this one has sat around for a bit.

If we are going to allow translating drafts the translation should be draft too and we seem to have at least 2 users with a use for that rather than blocking the translation so I'm 👍 on this. One small comment from me.

def test_post_submit_page_translation_from_draft_source_still_draft(self):
custom_page = make_test_page(
self.en_homepage,
cls=TestWithTranslationModeDisabledPage,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any particular reason for picking TestWithTranslationModeDisabledPage here? It isn't wrong, but this test isn't specifically about what happens when translation mode is off so it kind of distracts from the intent of the test IMO.

@zerolab
Copy link
Collaborator

zerolab commented May 6, 2022

Rebased, updated the test and merged in a7b0099. Thank you @AndrewCalderSpringload for the PR and @chris48s for the review

@zerolab zerolab closed this May 6, 2022
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.

Translating draft pages should not automatically make them go live
3 participants