mirror of
https://github.com/flarum/core.git
synced 2025-08-01 22:20:21 +02:00
Fix error when replying to a post by a deleted user
This commit is contained in:
@@ -10,7 +10,8 @@ export default function() {
|
|||||||
if (post.isHidden() || (app.session.user && !post.discussion().canReply())) return;
|
if (post.isHidden() || (app.session.user && !post.discussion().canReply())) return;
|
||||||
|
|
||||||
function insertMention(component, quote) {
|
function insertMention(component, quote) {
|
||||||
const mention = '@' + post.user().username() + '#' + post.id() + ' ';
|
const user = post.user();
|
||||||
|
const mention = '@' + (user ? user.username() : post.number()) + '#' + post.id() + ' ';
|
||||||
|
|
||||||
// If the composer is empty, then assume we're starting a new reply.
|
// If the composer is empty, then assume we're starting a new reply.
|
||||||
// In which case we don't want the user to have to confirm if they
|
// In which case we don't want the user to have to confirm if they
|
||||||
|
@@ -129,7 +129,7 @@ class UpdatePostMentionsMetadata
|
|||||||
->whereIn('id', $mentioned)
|
->whereIn('id', $mentioned)
|
||||||
->get()
|
->get()
|
||||||
->filter(function ($post) use ($reply) {
|
->filter(function ($post) use ($reply) {
|
||||||
return $post->user->id !== $reply->user->id;
|
return $post->user && $post->user->id !== $reply->user_id;
|
||||||
})
|
})
|
||||||
->all();
|
->all();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user