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.

profile: Add tooltip to hint unsubscription flow for private stream.

m-e-l-u-h-a-n524f0cc3d3e4
diff --git a/static/js/user_profile.js b/static/js/user_profile.js
index ac50e647fe3..33417d3169f 100644
--- a/static/js/user_profile.js
+++ b/static/js/user_profile.js
@@ -31,7 +31,10 @@ function compare_by_name(a, b) {
}
function format_user_stream_list_item(stream, user) {
- const show_unsubscribe_button = people.is_my_user_id(user.user_id) || settings_data.user_can_unsubscribe_other_users();
+ const show_unsubscribe_button =
+ people.is_my_user_id(user.user_id) || settings_data.user_can_unsubscribe_other_users();
+ const show_private_stream_unsub_tooltip =
+ people.is_my_user_id(user.user_id) && stream.invite_only;
return render_user_stream_list_item({
name: stream.name,
stream_id: stream.stream_id,
@@ -39,6 +42,7 @@ function format_user_stream_list_item(stream, user) {
invite_only: stream.invite_only,
is_web_public: stream.is_web_public,
show_unsubscribe_button,
+ show_private_stream_unsub_tooltip,
stream_edit_url: hash_util.stream_edit_uri(stream),
});
}
diff --git a/static/templates/user_stream_list_item.hbs b/static/templates/user_stream_list_item.hbs
index 44da635b646..f0c410cb2ca 100644
--- a/static/templates/user_stream_list_item.hbs
+++ b/static/templates/user_stream_list_item.hbs
@@ -8,7 +8,7 @@
{{#if show_unsubscribe_button}}
<td class="remove_subscription">
<div class="subscription_list_remove">
- <button type="button" name="unsubscribe" class="remove-subscription-button button small rounded btn-danger">
+ <button type="button" name="unsubscribe" class="remove-subscription-button button small rounded btn-danger {{#if show_private_stream_unsub_tooltip}}tippy-zulip-tooltip{{/if}}" data-tippy-content='{{t "Use stream settings to unsubscribe from private streams."}}'>
{{t 'Unsubscribe' }}
</button>
</div>