Skip to content

[5.x]: Author resets to the current user when a draft is applied by a different user with a provisional draft #17693

@MoritzLost

Description

@MoritzLost

What happened?

Description

We're seeing a bug where the author field changes unexpectedly in a specific scenario, which is common in an editorial workflow.

Steps to reproduce

  1. Alice opens an entry with the author set to Bob and makes a change, which results in a provisional draft being created. She leaves it at that.
  2. Bob manually creates a draft of the same entry and changes a different field in the draft.
  3. Now Alice opens the draft created by Bob and applies it to the entry. The draft is now published, and the changes made by Bob are live.
  4. However, Alice still has their provisional draft, so they see the changes made by them with the blue indicator, and the changes made by Bob (and applied as part of the draft) with the orange indicator. But also, the author has changed from Bob to Alice in the provisional draft. The author field doesn't get the indicator.
  5. Now Alice wants to apply the changes in the provisional draft to the entry, so she saves it. Now the author of the entry has been changed to Alice.

Edit: Found an even simpler way to reproduce, you don't even need two users. All that is required is that Alice has a provisional draft and then applies another (real) draft, even one they created themselves.

Expected behavior

When Alice applies the draft created by Bob, the author should not change to Alice automatically.

Actual behavior

The author changes unexpectedly in the provisional draft.

Additional context

I initially thought this was a problem in the Workflow plugin, because it happened in that context. But I can reproduce this issue without the plugin. This situation, however, is very common when using the Workflow plugin.

Craft CMS version

5.8.11

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions