Won't display revisions for anonymous users

Created on 19 September 2024, 2 months ago
Updated 20 September 2024, 2 months ago

Problem/Motivation

If the node has a revision whose authoring user has been deleted from Drupal then clicking on the "Show revisions" button results in an error:

Oops, something went wrong. Check your browser's developer console for more details.

The browser console says:

An AJAX HTTP error occurred.
HTTP Result Code: 503
Debugging information follows.
Path: /moderation_sidebar/node//revisions?latest=1

And the PHP error says:

Uncaught PHP Exception Error: "Call to a member function getDisplayName() on null" at /mnt/www/html//docroot/modules/contrib/moderation_sidebar/src/Controller/ModerationSidebarController.php

In our codebase line 374 is:

'#revision_author' => $user->getDisplayName(),

Steps to reproduce

  • Pick a node with multiple revisions from multiple authors, then choose one author to delete (note: it has to be an author in the top few revisions that is displayed in moderation sidebar by default)
  • Go to People Administration, find that user, edit them, and then choose "Cancel account"
  • On the cancellation page, choose the option "Delete the account and make its content belong to the Anonymous user. This action cannot be undone."
    • Proposed resolution

      Modify the code to display "Anonymous" if the user does not exist. This is how the node revisions history page works.

      Remaining tasks

      User interface changes

      API changes

      Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States jamesefrank

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024