Fix error when replying to a post by a deleted user

This commit is contained in:
Toby Zerner 2015-10-19 16:18:26 +10:30
parent 4d5a291d76
commit 49ed9c7dde
2 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,8 @@ export default function() {
if (post.isHidden() || (app.session.user && !post.discussion().canReply())) return;
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.
// In which case we don't want the user to have to confirm if they

View File

@ -1,4 +1,4 @@
<?php
<?php
/*
* This file is part of Flarum.
*
@ -129,7 +129,7 @@ class UpdatePostMentionsMetadata
->whereIn('id', $mentioned)
->get()
->filter(function ($post) use ($reply) {
return $post->user->id !== $reply->user->id;
return $post->user && $post->user->id !== $reply->user_id;
})
->all();