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

This commit is contained in:
m-e-l-u-h-a-n
2021-06-30 12:05:25 +05:30
committed by Tim Abbott
parent 68700e9599
commit 524f0cc3d3
2 changed files with 6 additions and 2 deletions

View File

@@ -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),
});
}

View File

@@ -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>