1
0
mirror of https://github.com/flarum/core.git synced 2025-08-13 03:44:32 +02:00

chore: simplify checking of current composer

This commit is contained in:
Sami Mazouz
2024-10-25 14:48:16 +01:00
parent 6e5180dcfe
commit 53ac644516
5 changed files with 14 additions and 23 deletions

View File

@@ -21,10 +21,7 @@ export default class PostMention extends MentionableModel<Post, AtMentionFormat>
* match any username characters that have been typed.
*/
initialResults(): Post[] {
const EditPostComposer = flarum.reg.checkModule('core', 'forum/components/EditPostComposer');
const ReplyComposer = flarum.reg.checkModule('core', 'forum/components/ReplyComposer');
if ((!ReplyComposer || !app.composer.bodyMatches(ReplyComposer)) && (!EditPostComposer || !app.composer.bodyMatches(EditPostComposer))) {
if (!app.composer.bodyMatches('flarum/forum/components/ReplyComposer') && !app.composer.bodyMatches('flarum/forum/components/EditPostComposer')) {
return [];
}

View File

@@ -26,9 +26,7 @@ export function insertMention(post, composer, quote) {
}
export default function reply(post, quote) {
const EditPostComposer = flarum.reg.checkModule('core', 'forum/components/EditPostComposer');
if (EditPostComposer && app.composer.bodyMatches(EditPostComposer) && app.composer.body.attrs.post.discussion() === post.discussion()) {
if (app.composer.bodyMatches('flarum/forum/components/EditPostComposer') && app.composer.body.attrs.post.discussion() === post.discussion()) {
// If we're already editing a post in the discussion of post we're quoting,
// insert the mention directly.
return insertMention(post, app.composer, quote);