mirror of
https://github.com/flarum/core.git
synced 2025-08-05 07:57:46 +02:00
fix(mentions): missed post mentions UI changes (#3832)
Co-authored-by: Ian Morland <ian@morland.me>
This commit is contained in:
@@ -118,7 +118,7 @@ export default function addMentionedByList() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const limit = 4;
|
const limit = 4;
|
||||||
const overLimit = repliers.length > limit;
|
const overLimit = post.mentionedByCount() > limit;
|
||||||
|
|
||||||
// Create a list of unique users who have replied. So even if a user has
|
// Create a list of unique users who have replied. So even if a user has
|
||||||
// replied twice, they will only be in this array once.
|
// replied twice, they will only be in this array once.
|
||||||
@@ -136,7 +136,7 @@ export default function addMentionedByList() {
|
|||||||
// others" name to the end of the list. Clicking on it will display a modal
|
// others" name to the end of the list. Clicking on it will display a modal
|
||||||
// with a full list of names.
|
// with a full list of names.
|
||||||
if (overLimit) {
|
if (overLimit) {
|
||||||
const count = repliers.length - names.length;
|
const count = post.mentionedByCount() - names.length;
|
||||||
|
|
||||||
names.push(app.translator.trans('flarum-mentions.forum.post.others_text', { count }));
|
names.push(app.translator.trans('flarum-mentions.forum.post.others_text', { count }));
|
||||||
}
|
}
|
||||||
|
@@ -50,6 +50,16 @@ class LoadMentionedByRelationship
|
|||||||
$loadable = $data->newCollection($data->posts)->filter(function ($post) {
|
$loadable = $data->newCollection($data->posts)->filter(function ($post) {
|
||||||
return $post instanceof Post;
|
return $post instanceof Post;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// firstPost and lastPost might have been included in the API response,
|
||||||
|
// so we have to make sure counts are also loaded for them.
|
||||||
|
if ($data->firstPost) {
|
||||||
|
$loadable->push($data->firstPost);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($data->lastPost) {
|
||||||
|
$loadable->push($data->lastPost);
|
||||||
|
}
|
||||||
} elseif ($data instanceof Collection) {
|
} elseif ($data instanceof Collection) {
|
||||||
$loadable = $data;
|
$loadable = $data;
|
||||||
} elseif ($data instanceof Post) {
|
} elseif ($data instanceof Post) {
|
||||||
|
Reference in New Issue
Block a user