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

I added these hooks in Zulip Desktop 5.5.0; handling these events in
the frontend will let us remove the janky desktop-side fallback code
that uses fake click events on menu items with specific indexes.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-12-02 11:34:15 -08:00
committed by Anders Kaseorg
parent c4d805a82c
commit bfd9999cf8
3 changed files with 17 additions and 0 deletions

View File

@@ -193,6 +193,7 @@ import "../search_pill";
import "../search_pill_widget"; import "../search_pill_widget";
import "../stream_ui_updates"; import "../stream_ui_updates";
import "../spoilers"; import "../spoilers";
import "../desktop_integration";
// Import styles // Import styles

View File

@@ -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 {};

View File

@@ -49,6 +49,7 @@ EXEMPT_FILES = {
'static/js/copy_and_paste.js', 'static/js/copy_and_paste.js',
'static/js/csrf.js', 'static/js/csrf.js',
'static/js/debug.js', 'static/js/debug.js',
'static/js/desktop_integration.js',
'static/js/drafts.js', 'static/js/drafts.js',
'static/js/echo.js', 'static/js/echo.js',
'static/js/emoji_picker.js', 'static/js/emoji_picker.js',