diff --git a/CHANGELOG.md b/CHANGELOG.md index 3499a1d86..bcddd5f9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ * recover temporary solution for html entities in browser title (e72541e35de4f71f9d870bbd9bb46ddf586bdf1d) * custom contrast color affected by parents (577890d89c593ae5b6cb96083fab69e2f1ae600c) * reply placeholder wrong positioning (253a3d281dbf5ce3fa712b629b80587cf67e7dbe) +* (mentions) missed post mentions UI changes with lazy loading [#3832] +* (mentions) cannot use newly introduced mentionables extender [#3849] +* (mentions) missing slug from post mention links ([5a4bb7c](5a4bb7ccf226f66dd44816cb69b3d7cfe4ad7f7c)) ## [v1.8.0](https://github.com/flarum/framework/compare/v1.7.1...v1.8.0) ### Fixed diff --git a/extensions/mentions/extend.php b/extensions/mentions/extend.php index b659d049d..5f9c568b8 100644 --- a/extensions/mentions/extend.php +++ b/extensions/mentions/extend.php @@ -78,15 +78,17 @@ return [ ->addInclude(['posts.mentionedBy', 'posts.mentionedBy.user', 'posts.mentionedBy.discussion']) ->load([ 'posts.mentionsUsers', 'posts.mentionsPosts', 'posts.mentionsPosts.user', - 'posts.mentionsGroups' + 'posts.mentionsPosts.discussion', 'posts.mentionsGroups' ]) ->loadWhere('posts.mentionedBy', LoadMentionedByRelationship::mutateRelation(...)) ->prepareDataForSerialization(LoadMentionedByRelationship::countRelation(...)), (new Extend\ApiController(Controller\ListDiscussionsController::class)) ->load([ - 'firstPost.mentionsUsers', 'firstPost.mentionsPosts', 'firstPost.mentionsPosts.user', 'firstPost.mentionsGroups', - 'lastPost.mentionsUsers', 'lastPost.mentionsPosts', 'lastPost.mentionsPosts.user', 'lastPost.mentionsGroups', + 'firstPost.mentionsUsers', 'firstPost.mentionsPosts', + 'firstPost.mentionsPosts.user', 'firstPost.mentionsPosts.discussion', 'firstPost.mentionsGroups', + 'lastPost.mentionsUsers', 'lastPost.mentionsPosts', + 'lastPost.mentionsPosts.user', 'lastPost.mentionsPosts.discussion', 'lastPost.mentionsGroups', ]), (new Extend\ApiController(Controller\ShowPostController::class)) @@ -98,7 +100,7 @@ return [ (new Extend\ApiController(Controller\ListPostsController::class)) ->addInclude(['mentionedBy', 'mentionedBy.user', 'mentionedBy.discussion']) - ->load(['mentionsUsers', 'mentionsPosts', 'mentionsPosts.user', 'mentionsGroups']) + ->load(['mentionsUsers', 'mentionsPosts', 'mentionsPosts.user', 'mentionsPosts.discussion', 'mentionsGroups']) ->loadWhere('mentionedBy', LoadMentionedByRelationship::mutateRelation(...)) ->prepareDataForSerialization(LoadMentionedByRelationship::countRelation(...)), diff --git a/extensions/mentions/js/src/forum/addComposerAutocomplete.js b/extensions/mentions/js/src/forum/addComposerAutocomplete.js index 09808a56a..a4f02e20e 100644 --- a/extensions/mentions/js/src/forum/addComposerAutocomplete.js +++ b/extensions/mentions/js/src/forum/addComposerAutocomplete.js @@ -5,12 +5,9 @@ import TextEditorButton from 'flarum/common/components/TextEditorButton'; import KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable'; import AutocompleteDropdown from './fragments/AutocompleteDropdown'; -import MentionFormats from './mentionables/formats/MentionFormats'; import MentionableModels from './mentionables/MentionableModels'; export default function addComposerAutocomplete() { - app.mentionFormats = new MentionFormats(); - const $container = $('
'); const dropdown = new AutocompleteDropdown(); diff --git a/extensions/mentions/js/src/forum/addMentionedByList.js b/extensions/mentions/js/src/forum/addMentionedByList.js index 45b54023d..48fe082f6 100644 --- a/extensions/mentions/js/src/forum/addMentionedByList.js +++ b/extensions/mentions/js/src/forum/addMentionedByList.js @@ -118,7 +118,7 @@ export default function addMentionedByList() { }); 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 // 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 // with a full list of names. 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 })); } diff --git a/extensions/mentions/js/src/forum/extenders/Mentionables.ts b/extensions/mentions/js/src/forum/extenders/Mentionables.ts index cf2db51f7..46423ae54 100644 --- a/extensions/mentions/js/src/forum/extenders/Mentionables.ts +++ b/extensions/mentions/js/src/forum/extenders/Mentionables.ts @@ -5,7 +5,7 @@ import type MentionFormat from '../mentionables/formats/MentionFormat'; export default class Mentionables implements IExtender