mirror of
https://github.com/flarum/core.git
synced 2025-08-01 14:10:37 +02:00
Fix unrecognised user/post mentions (#71)
* fix: Use proper mentionsUsers serializer The only reason we haven't seen any issues with this up until now is because we have not has to include the relationship in any responses. * fix: User/Post mentions showing as deleted after saving The reason this happens is because the modified relationship is not refreshed, so the formatter doesn't recognize the new mentions as valid.
This commit is contained in:
@@ -55,6 +55,7 @@ class UpdateMentionsMetadataWhenVisible
|
||||
protected function syncUserMentions(Post $post, array $mentioned)
|
||||
{
|
||||
$post->mentionsUsers()->sync($mentioned);
|
||||
$post->unsetRelation('mentionsUsers');
|
||||
|
||||
$users = User::whereIn('id', $mentioned)
|
||||
->get()
|
||||
@@ -69,6 +70,7 @@ class UpdateMentionsMetadataWhenVisible
|
||||
protected function syncPostMentions(Post $reply, array $mentioned)
|
||||
{
|
||||
$reply->mentionsPosts()->sync($mentioned);
|
||||
$reply->unsetRelation('mentionsPosts');
|
||||
|
||||
$posts = Post::with('user')
|
||||
->whereIn('id', $mentioned)
|
||||
|
Reference in New Issue
Block a user