From 0a3f449f9e034c76ba3048a07c6cb7c2aebb509b Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Thu, 2 Jun 2022 13:38:24 +0100 Subject: [PATCH] fix: post mentions with deleted author not rendering (#3432) --- extensions/mentions/src/ConfigureMentions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extensions/mentions/src/ConfigureMentions.php b/extensions/mentions/src/ConfigureMentions.php index 444e5415c..a85727707 100644 --- a/extensions/mentions/src/ConfigureMentions.php +++ b/extensions/mentions/src/ConfigureMentions.php @@ -125,10 +125,13 @@ class ConfigureMentions { $post = CommentPost::find($tag->getAttribute('id')); - if ($post && $post->user) { + if ($post) { $tag->setAttribute('discussionid', (int) $post->discussion_id); $tag->setAttribute('number', (int) $post->number); - $tag->setAttribute('displayname', $post->user->display_name); + + if ($post->user) { + $tag->setAttribute('displayname', $post->user->display_name); + } return true; }