Problem/Motivation
When adding a new unpublished content entity in a workspace, the workspace revision metadata field on the entity is not set, resulting in the content being attributed to 'Live'. The content is still attached to the workspace in a workspace_association
table row.
As things stand if a user is in a workspace and creates a piece of content it does not appear in that workspace when using views that filter by workspace.
SELECT * FROM node_revision WHERE nid = 1; SELECT * FROM workspace_association WHERE target_entity_id = 1;
nid vid langcode revision_uid revision_timestamp revision_log revision_default workspace
---------- ---------- ---------- ------------ ------------------ ------------ ---------------- ----------
1 1 en 1 1587501174 1
workspace target_entity_type_id target_entity_id target_entity_revision_id
---------- --------------------- ---------------- -------------------------
stage node 1 1
This workspace field is set when
- A new revision is created on an existing entity
- A new published entity is created
Proposed resolution
Track the initial revisions created in a workspace, for both published and unpublished entities.