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.

message controls: Use login_to_access modal for reactions/stars.

Tim Abbott45387925171a
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index b0af85d0c64..1466762ea03 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -39,6 +39,7 @@ import * as rows from "./rows";
import * as server_events from "./server_events";
import * as settings_panel_menu from "./settings_panel_menu";
import * as settings_toggle from "./settings_toggle";
+import * as spectators from "./spectators";
import * as stream_list from "./stream_list";
import * as stream_popover from "./stream_popover";
import * as topic_list from "./topic_list";
@@ -213,6 +214,11 @@ export function initialize() {
e.stopPropagation();
popovers.hide_all();
+ if (page_params.is_spectator) {
+ spectators.login_to_access();
+ return;
+ }
+
const message_id = rows.id($(this).closest(".message_row"));
const message = message_store.get(message_id);
message_flags.toggle_starred_and_update_server(message);
@@ -220,6 +226,12 @@ export function initialize() {
$("#main_div").on("click", ".message_reaction", function (e) {
e.stopPropagation();
+
+ if (page_params.is_spectator) {
+ spectators.login_to_access();
+ return;
+ }
+
emoji_picker.hide_emoji_popover();
const local_id = $(this).attr("data-reaction-id");
const message_id = rows.get_message_id(this);
diff --git a/static/js/emoji_picker.js b/static/js/emoji_picker.js
index 7f113a9b163..9200651c248 100644
--- a/static/js/emoji_picker.js
+++ b/static/js/emoji_picker.js
@@ -12,9 +12,11 @@ import * as compose_ui from "./compose_ui";
import * as emoji from "./emoji";
import * as message_lists from "./message_lists";
import * as message_store from "./message_store";
+import {page_params} from "./page_params";
import * as popovers from "./popovers";
import * as reactions from "./reactions";
import * as rows from "./rows";
+import * as spectators from "./spectators";
import * as ui from "./ui";
import {user_settings} from "./user_settings";
import * as user_status_ui from "./user_status_ui";
@@ -718,6 +720,11 @@ export function register_click_handlers() {
$("#main_div").on("click", ".reaction_button", function (e) {
e.stopPropagation();
+ if (page_params.is_spectator) {
+ spectators.login_to_access();
+ return;
+ }
+
const message_id = rows.get_message_id(this);
toggle_emoji_popover(this, message_id);
});
diff --git a/static/templates/message_controls.hbs b/static/templates/message_controls.hbs
index c9d4b8d9d94..4d736806678 100644
--- a/static/templates/message_controls.hbs
+++ b/static/templates/message_controls.hbs
@@ -1,10 +1,10 @@
<div class="message_controls{{#status_message}} sender-status-controls{{/status_message}} no-select">
{{#if msg/sent_by_me}}
- <div class="edit_content message_control_button hidden-for-spectators"></div>
+ <div class="edit_content message_control_button"></div>
{{/if}}
{{#unless msg/sent_by_me}}
- <div class="reaction_button message_control_button hidden-for-spectators" data-tippy-content="{{t 'Add emoji reaction' }} (:)">
+ <div class="reaction_button message_control_button" data-tippy-content="{{t 'Add emoji reaction' }} (:)">
<i class="fa fa-smile-o" aria-label="{{#tr}}Add emoji reaction{{/tr}} (:)" role="button" aria-haspopup="true" tabindex="0"></i>
</div>
{{/unless}}
@@ -26,7 +26,7 @@
</div>
{{#unless msg/locally_echoed}}
- <div class="star_container message_control_button {{#if msg/starred}}{{else}}empty-star{{/if}} hidden-for-spectators" data-tippy-content="{{#with msg}}{{#tr}}{starred_status} this message{{/tr}}{{/with}} (Ctrl + s)">
+ <div class="star_container message_control_button {{#if msg/starred}}{{else}}empty-star{{/if}}" data-tippy-content="{{#with msg}}{{#tr}}{starred_status} this message{{/tr}}{{/with}} (Ctrl + s)">
<i role="button" tabindex="0" class="star fa {{#if msg/starred}}fa-star{{else}}fa-star-o{{/if}}"></i>
</div>
{{/unless}}
diff --git a/static/templates/message_reactions.hbs b/static/templates/message_reactions.hbs
index a2eb550dd8c..c6c1ee3b3a8 100644
--- a/static/templates/message_reactions.hbs
+++ b/static/templates/message_reactions.hbs
@@ -1,7 +1,7 @@
{{#each this/msg/message_reactions}}
{{> message_reaction}}
{{/each}}
-<div class="reaction_button hidden-for-spectators" data-tippy-content="{{t 'Add emoji reaction' }}" aria-label="{{t 'Add emoji reaction' }} (:)">
+<div class="reaction_button" data-tippy-content="{{t 'Add emoji reaction' }}" aria-label="{{t 'Add emoji reaction' }} (:)">
<i class="fa fa-smile-o" role="button" aria-haspopup="true" tabindex="0" aria-label="{{t 'Add emoji reaction' }} (:)"></i>
<div class="message_reaction_count">+</div>
</div>