Skip to content

When an item has the state of Published, the state element incorrectly shows Draft (Current) #31

@jenlampton

Description

@jenlampton

The moderation state select element uses (Current) in the option label to mark the current state.

The problem

When the current state is Published this element incorrectly marks the default ('Draft' in this case) state as current.

Image

Expected behavior

The expected behavior is that the (Current) indicator should ALWAYS show the current state.

Why is this happening?

There is some code that appears to be making this change on purpose, causing the wrong version to be labeled "Current"

  // We have a use case where a published node is being edited. This will always
  // revert back to the original node status.
  if ($moderation_state == content_moderation_state_published()) {
    $moderation_state = content_moderation_state_none();
  }

Related but perhaps not the same:

Ideally the default value for the select list would also be the current state. I'm not sure I understand the use-case of having the select list not match reality? I think I understand now, people using the "New Draft" tab might be expecting to create a new draft, instead of editing the published node.

But then how would one edit the published node (thus creating a new, published revision) without creating a new draft revision first? Hitting Edit and then Save (without intentionally changing anything) could accidentally end up in Published content being reverted to Draft state.

I would recommend we remove this section of code entirely. If the use-case described in the code comment pops up again, we can better document what it is exactly, what is expected in that scenario, and implement a solution that won't affect everyone else negatively

I would recommend that we label the current state correctly in the select list. Other changes may need further discussion!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions