mirror of
https://github.com/flarum/core.git
synced 2025-08-16 21:34:08 +02:00
chore: simplify checking of current composer
This commit is contained in:
@@ -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 [];
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -24,11 +24,7 @@ app.initializers.add('flarum-messages', () => {
|
||||
);
|
||||
|
||||
app.composer.composingMessageTo = function (dialog: Dialog) {
|
||||
const MessageComposer = flarum.reg.checkModule('flarum-messages', 'forum/components/MessageComposer');
|
||||
|
||||
if (!MessageComposer) return false;
|
||||
|
||||
return this.isVisible() && this.bodyMatches(MessageComposer, { dialog });
|
||||
return this.isVisible() && this.bodyMatches('flarum/messages/forum/components/MessageComposer', { dialog });
|
||||
};
|
||||
|
||||
extend(IndexSidebar.prototype, 'navItems', function (items) {
|
||||
|
Reference in New Issue
Block a user