Problem/Motivation

When a translation is added for an entity, the workspaces module will attach the translation to the default revision, and that operation will run outside of a workspace. That is problematic, because all code that reacts to the event will run its logic in the live workspace. One such example is Drupal\path\Plugin\Field\FieldType::postSave that will create a path alias in the live workspace.

Steps to reproduce

1. On a multilingual site create an unpublished node in the Live workspace
2. Create a new workspace
3. Add a manual path alias to the english/default language of the node, and publish the node
4. Add a translation for the node (language of your choice)
5. Notice that a path alias for the translated node gets created in the live workspace, not in the active workspace

Proposed resolution

Instead of attaching the translation to the main revision in the live WS, do it in the current WS.

Remaining tasks

Post a MR

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3518220

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alecsmrekar created an issue. See original summary.

alecsmrekar’s picture

Issue summary: View changes

alecsmrekar’s picture

Assigned: alecsmrekar » Unassigned
Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Will need test coverage as a next step. Thanks!

plach’s picture

This is working well in our project, we "just" need to add test coverage now :)

alecsmrekar’s picture

Status: Needs work » Needs review
plach’s picture

Status: Needs review » Reviewed & tested by the community

Test looks good!

amateescu’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs tests

Posted a few comments on the MR.

alecsmrekar’s picture

Status: Needs work » Needs review
amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Looks great now!

catch’s picture

Status: Reviewed & tested by the community » Needs work

One comment on the MR.

alecsmrekar’s picture

Status: Needs work » Needs review
plach’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

  • catch committed d84dba05 on 11.x
    Issue #3518220 by alecsmrekar, plach, amateescu: Translations created in...

catch’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.