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.

hotkey: Disable message interaction for spectators with keyboard.

Aman Agrawal0254187771f2
diff --git a/static/js/hotkey.js b/static/js/hotkey.js
index bb4173e2efd..f02ea02e22f 100644
--- a/static/js/hotkey.js
+++ b/static/js/hotkey.js
@@ -35,6 +35,7 @@ import * as recent_topics_ui from "./recent_topics_ui";
import * as recent_topics_util from "./recent_topics_util";
import * as search from "./search";
import * as settings_data from "./settings_data";
+import * as spectators from "./spectators";
import * as stream_list from "./stream_list";
import * as stream_popover from "./stream_popover";
import * as stream_settings_ui from "./stream_settings_ui";
@@ -864,6 +865,17 @@ export function process_hotkey(e, hotkey) {
return true;
}
+ if (
+ // Allow UI only features for spectators which they can perform.
+ page_params.is_spectator &&
+ !["narrow_by_topic", "narrow_by_recipient", "show_lightbox", "show_sender_info"].includes(
+ event_name,
+ )
+ ) {
+ spectators.login_to_access();
+ return true;
+ }
+
const msg = message_lists.current.selected_message();
// Shortcuts that operate on a message
switch (event_name) {
diff --git a/static/js/popovers.js b/static/js/popovers.js
index c011e21e421..dcf198dc0ef 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -764,7 +764,7 @@ export function show_sender_info() {
const message = message_lists.current.get(rows.id($message));
const user = people.get_by_user_id(message.sender_id);
show_user_info_popover_for_message($sender[0], user, message);
- if (current_message_info_popover_elem) {
+ if (current_message_info_popover_elem && !page_params.is_spectator) {
focus_user_info_popover_item();
}
}