streams: Update modals shown on removing user from private stream.

This commit adds "?" to the heading of modal shown when unsubscribing
user from private stream and adds a link to help documentation for
archiving streams. This commit also refactors the code such that we
can use the same template to show modal when unsubscribing others
from private streams.
This commit is contained in:
Sahil Batra 2023-10-06 16:47:36 +05:30 committed by Tim Abbott
parent d63906ba2f
commit 052299f056
3 changed files with 13 additions and 10 deletions

View File

@ -263,15 +263,13 @@ function remove_subscriber({stream_id, target_user_id, $list_entry}) {
});
const html_body = render_unsubscribe_private_stream_modal({
message: $t({
defaultMessage: "Once you leave this stream, you will not be able to rejoin.",
}),
unsubscribing_other_user: false,
display_stream_archive_warning: sub_count === 1,
});
confirm_dialog.launch({
html_heading: $t_html(
{defaultMessage: "Unsubscribe from <z-link></z-link>"},
{defaultMessage: "Unsubscribe from <z-link></z-link>?"},
{"z-link": () => stream_name_with_privacy_symbol_html},
),
html_body,

View File

@ -196,9 +196,7 @@ export function unsubscribe_from_private_stream(sub) {
const stream_name_with_privacy_symbol_html = render_inline_decorated_stream_name({stream: sub});
const html_body = render_unsubscribe_private_stream_modal({
message: $t({
defaultMessage: "Once you leave this stream, you will not be able to rejoin.",
}),
unsubscribing_other_user: false,
display_stream_archive_warning: sub_count === 1 && invite_only,
});
@ -215,7 +213,7 @@ export function unsubscribe_from_private_stream(sub) {
confirm_dialog.launch({
html_heading: $t_html(
{defaultMessage: "Unsubscribe from <z-link></z-link>"},
{defaultMessage: "Unsubscribe from <z-link></z-link>?"},
{"z-link": () => stream_name_with_privacy_symbol_html},
),
html_body,

View File

@ -1,4 +1,11 @@
<p>{{message}}</p>
{{#unless unsubscribing_other_user}}
<p>{{t "Once you leave this stream, you will not be able to rejoin."}}</p>
{{/unless}}
{{#if display_stream_archive_warning}}
<p>{{t "Because you are the only subscriber, this stream will be automatically archived." }}</p>
<p>
{{#tr}}
Because you are the only subscriber, this stream will be automatically <z-link>archived</z-link>.
{{#*inline "z-link"}}<a target="_blank" rel="noopener noreferrer" href="/help/archive-a-stream">{{> @partial-block}}</a>{{/inline}}
{{/tr}}
</p>
{{/if}}