- πΊπΈUnited States darren oh Lakeland, Florida
Darren Oh β made their first commit to this issueβs fork.
- Status changed to Needs review
9 months ago 7:05pm 19 February 2024 - πΊπΈUnited States darren oh Lakeland, Florida
catch was just asking a question. This change is necessary to ensure predictable behavior with code that is not workspace-aware. I am currently trying to set up workspaces for a major client, and a blocker is that the edit tab does not load the revision for the current workspace by default.
- Merge request !6681Resolve #3045177 "Workspace specific latest revision" β (Open) created by darren oh
- Merge request !6682Resolve #3045177 "Workspace specific latest revision d10" β (Closed) created by darren oh
- Status changed to Needs work
9 months ago 7:23pm 20 February 2024 - π·π΄Romania amateescu
@Darren Oh, I think you're the first one to actually bump into this problem that was only theoretical so far, so I'm wondering if you can share any more info about the code that is not workspace-aware and it was loading the wrong revision :)
As for the MR, let's switch the order in the condition and check for
isEntityTypeSupported()
beforehasActiveWorkspace()
, see π Fix workspace-support check in entity queries Fixed for a recent example why this matters. - πΊπΈUnited States darren oh Lakeland, Florida
Sure I can share more info. If you have multiple workspaces, the first workspace in which a node is edited blocks editing in all other workspaces because the edit tab always loads the most recent revision. You'll get a message saying the node is being edited in another workspace and changes cannot be saved. The expected behavior is that the most recent live revision is loaded and copied to the current workspace.
- π·π΄Romania amateescu
The expected behavior is that the most recent live revision is loaded and copied to the current workspace.
That's not the expected behavior in core at the moment. Editing the same entity in different workspaces requires a conflict resolution solution, which doesn't exist in core (yet?), that's why we actively prevent it.
If you'd like to give editors the ability to edit the same entity in different workspaces, with the (important!) caveat that whichever workspace is published last "wins" (i.e. the changes from the previously-published workspace will be lost), I'd suggest to override the plugin class of the
EntityWorkspaceConflict
constraint with a custom one. - πΊπΈUnited States darren oh Lakeland, Florida
I did override the
EntityWorkspaceConflict
constraint. Also had to apply the fix from this issue. - π·π΄Romania amateescu
There must be something else at play then, because I tried the snippet below and the following steps:
1. edit a node in a workspace, save
2. edit the node in Live, save
3. create a new workspace, and editing the node showed me the revision created in step 2.--- a/core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php +++ b/core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php @@ -79,6 +79,7 @@ public static function create(ContainerInterface $container) { * {@inheritdoc} */ public function validate($entity, Constraint $constraint) { + return; /** @var \Drupal\Core\Entity\EntityInterface $entity */ if (isset($entity) && !$entity->isNew()) { $active_workspace = $this->workspaceManager->getActiveWorkspace();
- Status changed to Postponed: needs info
7 months ago 3:06pm 19 April 2024