Problem/Motivation

ListUsageController::buildRows() classifies a usage record as current or old by comparing its source_vid to the source entity's default revision ID. It demotes a pending record to old, but only when a newer pending source_vid exists among the target's usage records.

This fails when the target is not referenced in the latest source revision, since no usage record exists at that vid. Example: the published revision (vid 10) has no usage, an old draft (vid 12) has usage, and the latest draft (vid 15) has none. The vid 12 record is shown as a draft instead of old.

Steps to reproduce

  1. Create a published revision of a node.
  2. Create a draft with a media usage.
  3. Create another draft removing the media usage.

This should should as 1 usage in an old revision because the old draft at this point is an old revision but it will show as a draft revision usage. If you go to edit the node you will not see the media.

Proposed resolution

Fix this in a performance and translation aware way.

Remaining tasks

User interface changes

API changes

Data model changes

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

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Reviewed & tested by the community

We've got good test coverage around this and it plays well with the new capability to exclude old revisions so by default you only see usages in published revisions or the latest draft.

  • alexpott committed e8599392 on 5.x
    fix: #3624974 Old draft usage is misclassified as current when the...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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