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.

user_profile: Show tooltip when removing last user from private stream.

Sahil Batraeffc9c366a28
diff --git a/web/src/user_profile.js b/web/src/user_profile.js
index ef2d3dbf18c..4b74973b17a 100644
--- a/web/src/user_profile.js
+++ b/web/src/user_profile.js
@@ -173,6 +173,8 @@ function format_user_stream_list_item_html(stream, user) {
people.can_admin_user(user) || stream_data.can_unsubscribe_others(stream);
const show_private_stream_unsub_tooltip =
people.is_my_user_id(user.user_id) && stream.invite_only;
+ const show_last_user_in_private_stream_unsub_tooltip =
+ stream.invite_only && peer_data.get_subscriber_count(stream.stream_id) === 1;
return render_user_stream_list_item({
name: stream.name,
stream_id: stream.stream_id,
@@ -181,6 +183,7 @@ function format_user_stream_list_item_html(stream, user) {
is_web_public: stream.is_web_public,
show_unsubscribe_button,
show_private_stream_unsub_tooltip,
+ show_last_user_in_private_stream_unsub_tooltip,
stream_edit_url: hash_util.stream_edit_url(stream),
});
}
diff --git a/web/templates/user_stream_list_item.hbs b/web/templates/user_stream_list_item.hbs
index 146eb753a82..1e0b799c2c8 100644
--- a/web/templates/user_stream_list_item.hbs
+++ b/web/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 {{#if show_private_stream_unsub_tooltip}}tippy-zulip-tooltip{{/if}}" data-tippy-content='{{t "Use stream settings to unsubscribe from private streams."}}'>
+ <button type="button" name="unsubscribe" class="remove-subscription-button button small rounded btn-danger {{#if (or show_private_stream_unsub_tooltip show_last_user_in_private_stream_unsub_tooltip)}}tippy-zulip-tooltip{{/if}}" data-tippy-content='{{#if show_private_stream_unsub_tooltip}}{{t "Use stream settings to unsubscribe from private streams."}}{{else}}{{t "Use stream settings to unsubscribe the last user from a private stream."}}{{/if}}'>
{{t 'Unsubscribe' }}
</button>
</div>