Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

desktop_integration: Handle logout et al. events from desktop app.

Anders Kaseorgbfd9999cf874
diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js
index 5e98f92531c..5ca907197bc 100644
--- a/static/js/bundles/app.js
+++ b/static/js/bundles/app.js
@@ -193,6 +193,7 @@ import "../search_pill";
import "../search_pill_widget";
import "../stream_ui_updates";
import "../spoilers";
+import "../desktop_integration";
// Import styles
diff --git a/static/js/desktop_integration.js b/static/js/desktop_integration.js
new file mode 100644
index 00000000000..cdd68150a53
--- /dev/null
+++ b/static/js/desktop_integration.js
@@ -0,0 +1,15 @@
+if (window.electron_bridge !== undefined) {
+ window.electron_bridge.on_event("logout", () => {
+ $("#logout_form").trigger("submit");
+ });
+
+ window.electron_bridge.on_event("show-keyboard-shortcuts", () => {
+ hashchange.go_to_location("keyboard-shortcuts");
+ });
+
+ window.electron_bridge.on_event("show-notification-settings", () => {
+ hashchange.go_to_location("settings/notifications");
+ });
+}
+
+export {};
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index 71707d4f474..92818be938c 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -49,6 +49,7 @@ EXEMPT_FILES = {
'static/js/copy_and_paste.js',
'static/js/csrf.js',
'static/js/debug.js',
+ 'static/js/desktop_integration.js',
'static/js/drafts.js',
'static/js/echo.js',
'static/js/emoji_picker.js',