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.

settings: Add tooltip for user read receipts setting.

Sahil Batra8302337aa9fd
diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js
index 91ddb2b787a..44b4d40d662 100644
--- a/static/js/server_events_dispatch.js
+++ b/static/js/server_events_dispatch.js
@@ -227,6 +227,7 @@ export function dispatch_normal_event(event) {
waiting_period_threshold: noop,
want_advertise_in_communities_directory: noop,
wildcard_mention_policy: noop,
+ enable_read_receipts: settings_account.update_send_read_receipts_tooltip,
};
switch (event.op) {
case "update":
diff --git a/static/js/settings.js b/static/js/settings.js
index e8929e1485a..c18818c6f58 100644
--- a/static/js/settings.js
+++ b/static/js/settings.js
@@ -100,6 +100,9 @@ export function build_page() {
default_language_name: settings_display.user_default_language_name,
realm_push_notifications_enabled: page_params.realm_push_notifications_enabled,
settings_object: user_settings,
+ send_read_receipts_tooltip: $t({
+ defaultMessage: "Read receipts are currently disabled in this organization.",
+ }),
});
$(".settings-box").html(rendered_settings_tab);
diff --git a/static/js/settings_account.js b/static/js/settings_account.js
index 5f43df232b0..b7aa73f531e 100644
--- a/static/js/settings_account.js
+++ b/static/js/settings_account.js
@@ -78,6 +78,14 @@ export function update_avatar_change_display() {
}
}
+export function update_send_read_receipts_tooltip() {
+ if (page_params.realm_enable_read_receipts) {
+ $("#send_read_receipts_label .settings-info-icon").hide();
+ } else {
+ $("#send_read_receipts_label .settings-info-icon").show();
+ }
+}
+
function display_avatar_upload_complete() {
$("#user-avatar-upload-widget .upload-spinner-background").css({visibility: "hidden"});
$("#user-avatar-upload-widget .image-upload-text").show();
diff --git a/static/styles/settings.css b/static/styles/settings.css
index 3b86d569cb4..1dd88a8cd96 100644
--- a/static/styles/settings.css
+++ b/static/styles/settings.css
@@ -31,6 +31,11 @@ h3,
opacity: 1;
}
}
+
+ .fa-info-circle {
+ top: 1px;
+ position: relative;
+ }
}
/* TODO: This should ideally be added to help_link_widget.hbs,
diff --git a/static/templates/settings/account_settings.hbs b/static/templates/settings/account_settings.hbs
index ee623357a16..5b8c6118ed7 100644
--- a/static/templates/settings/account_settings.hbs
+++ b/static/templates/settings/account_settings.hbs
@@ -68,6 +68,8 @@
setting_name="send_read_receipts"
is_checked=settings_object.send_read_receipts
label=settings_label.send_read_receipts
+ tooltip_text=send_read_receipts_tooltip
+ hide_tooltip=page_params.realm_enable_read_receipts
}}
{{/if}}
</div>
diff --git a/static/templates/settings/settings_checkbox.hbs b/static/templates/settings/settings_checkbox.hbs
index 76437e5134a..9779535f868 100644
--- a/static/templates/settings/settings_checkbox.hbs
+++ b/static/templates/settings/settings_checkbox.hbs
@@ -10,6 +10,9 @@
{{#if help_link}}
{{> ../help_link_widget link=help_link }}
{{/if}}
+ {{#if tooltip_text}}
+ <i class="tippy-zulip-tooltip fa fa-info-circle settings-info-icon" {{#if hide_tooltip}}style="display: none;"{{/if}} data-tippy-content="{{tooltip_text}}"></i>
+ {{/if}}
</label>
</div>
{{/unless}}