mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 11:20:57 -06:00
DEV: Rely on route action to open composer. (#17118)
Avoid duplicating composer logic in multiple places.
This commit is contained in:
parent
78fab9b7e1
commit
222a7755a0
@ -1,9 +1,6 @@
|
||||
import { action } from "@ember/object";
|
||||
import { cached } from "@glimmer/tracking";
|
||||
|
||||
import GlimmerComponent from "discourse/components/glimmer";
|
||||
import Composer from "discourse/models/composer";
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
import GroupMessageSectionLink from "discourse/lib/sidebar/messages-section/group-message-section-link";
|
||||
import PersonalMessageSectionLink from "discourse/lib/sidebar/messages-section/personal-message-section-link";
|
||||
|
||||
@ -90,14 +87,4 @@ export default class SidebarMessagesSection extends GlimmerComponent {
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
@action
|
||||
composePersonalMessage() {
|
||||
const composerArgs = {
|
||||
action: Composer.PRIVATE_MESSAGE,
|
||||
draftKey: Composer.NEW_TOPIC_KEY,
|
||||
};
|
||||
|
||||
getOwner(this).lookup("controller:composer").open(composerArgs);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
@sectionName="messages"
|
||||
@headerRoute="userPrivateMessages.index"
|
||||
@headerModel={{this.currentUser}}
|
||||
@headerAction={{this.composePersonalMessage}}
|
||||
@headerAction={{fn (route-action "composePrivateMessage") null null}}
|
||||
@headerActionIcon="plus"
|
||||
@headerLinkText={{i18n "sidebar.sections.messages.header_link_text"}}
|
||||
@headerLinkTitle={{i18n "sidebar.sections.messages.header_link_title"}} >
|
||||
|
Loading…
Reference in New Issue
Block a user