FIX: Use context sensitive "create topic" via keyboard if possible
This commit is contained in:
parent
8e795d82f9
commit
a518950e52
|
@ -196,12 +196,21 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
createTopic() {
|
createTopic() {
|
||||||
if (this.currentUser && this.currentUser.can_create_topic) {
|
if (!(this.currentUser && this.currentUser.can_create_topic)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the page has a create-topic button, use it for context sensitive attributes like category
|
||||||
|
let $createTopicButton = $("#create-topic");
|
||||||
|
if ($createTopicButton.length) {
|
||||||
|
$createTopicButton.click();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.container.lookup("controller:composer").open({
|
this.container.lookup("controller:composer").open({
|
||||||
action: Composer.CREATE_TOPIC,
|
action: Composer.CREATE_TOPIC,
|
||||||
draftKey: Composer.CREATE_TOPIC
|
draftKey: Composer.CREATE_TOPIC
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
focusComposer() {
|
focusComposer() {
|
||||||
|
|
Loading…
Reference in New Issue