Skip to content

A platform for community discussion. Free, open, simple.

DEV: Move keyboard shortcuts modal launching (#36085)

Jarek Radosz380a1379074d
diff --git a/frontend/discourse/app/lib/keyboard-shortcuts.js b/frontend/discourse/app/lib/keyboard-shortcuts.js
index 44d50c40f39..b43eb22f08e 100644
--- a/frontend/discourse/app/lib/keyboard-shortcuts.js
+++ b/frontend/discourse/app/lib/keyboard-shortcuts.js
@@ -1,5 +1,6 @@
import { getOwner, setOwner } from "@ember/owner";
import { run, throttle } from "@ember/runloop";
+import KeyboardShortcutsHelp from "discourse/components/modal/keyboard-shortcuts-help";
import { ajax } from "discourse/lib/ajax";
import domUtils from "discourse/lib/dom-utils";
import { INPUT_DELAY } from "discourse/lib/environment";
@@ -157,6 +158,7 @@ export default {
this.appEvents = owner.lookup("service:app-events");
this.composer = owner.lookup("service:composer");
this.currentUser = owner.lookup("service:current-user");
+ this.modal = owner.lookup("service:modal");
this.router = owner.lookup("service:router");
this.searchService = owner.lookup("service:search");
this.siteSettings = owner.lookup("service:site-settings");
@@ -551,10 +553,7 @@ export default {
showHelpModal(event) {
event.preventDefault();
-
- getOwner(this)
- .lookup("controller:application")
- .send("showKeyboardShortcutsHelp");
+ this.modal.show(KeyboardShortcutsHelp);
},
setTrackingToMuted() {
diff --git a/frontend/discourse/app/routes/application.js b/frontend/discourse/app/routes/application.js
index a6c6d0b6a30..632ea411555 100644
--- a/frontend/discourse/app/routes/application.js
+++ b/frontend/discourse/app/routes/application.js
@@ -1,7 +1,6 @@
import { action } from "@ember/object";
import { getOwner } from "@ember/owner";
import { service } from "@ember/service";
-import KeyboardShortcutsHelp from "discourse/components/modal/keyboard-shortcuts-help";
import NotActivatedModal from "discourse/components/modal/not-activated";
import { RouteException } from "discourse/controllers/exception";
import { setting } from "discourse/lib/computed";
@@ -201,11 +200,6 @@ export default class ApplicationRoute extends DiscourseRoute {
document.getElementById("file-uploader").click();
}
- @action
- showKeyboardShortcutsHelp() {
- this.modal.show(KeyboardShortcutsHelp);
- }
-
// Close the current modal, and destroy its state.
@action
closeModal(initiatedBy) {