streams: Add stream symbol to unsubscribe confirmation modal.

This commit adds the appropriate stream symbol to the
heading of the "Unsubscribe from stream" confirmation modal.

Fixes: #23953
This commit is contained in:
Akarsh Jain
2023-01-03 12:04:25 +05:30
committed by Tim Abbott
parent 5f4bdfe6bc
commit b0928f55e7
2 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import $ from "jquery"; import $ from "jquery";
import render_unsubscribe_private_stream_modal from "../templates/confirm_dialog/confirm_unsubscribe_private_stream.hbs"; import render_unsubscribe_private_stream_modal from "../templates/confirm_dialog/confirm_unsubscribe_private_stream.hbs";
import render_inline_decorated_stream_name from "../templates/inline_decorated_stream_name.hbs";
import render_stream_member_list_entry from "../templates/stream_settings/stream_member_list_entry.hbs"; import render_stream_member_list_entry from "../templates/stream_settings/stream_member_list_entry.hbs";
import render_stream_members from "../templates/stream_settings/stream_members.hbs"; import render_stream_members from "../templates/stream_settings/stream_members.hbs";
import render_stream_subscription_request_result from "../templates/stream_settings/stream_subscription_request_result.hbs"; import render_stream_subscription_request_result from "../templates/stream_settings/stream_subscription_request_result.hbs";
@@ -252,6 +253,9 @@ function remove_subscriber({stream_id, target_user_id, $list_entry}) {
if (sub.invite_only && people.is_my_user_id(target_user_id)) { if (sub.invite_only && people.is_my_user_id(target_user_id)) {
const sub_count = peer_data.get_subscriber_count(stream_id); const sub_count = peer_data.get_subscriber_count(stream_id);
const stream_name_with_privacy_symbol_html = render_inline_decorated_stream_name({
stream: sub,
});
const html_body = render_unsubscribe_private_stream_modal({ const html_body = render_unsubscribe_private_stream_modal({
message: $t({ message: $t({
@@ -262,8 +266,8 @@ function remove_subscriber({stream_id, target_user_id, $list_entry}) {
confirm_dialog.launch({ confirm_dialog.launch({
html_heading: $t_html( html_heading: $t_html(
{defaultMessage: "Unsubscribe from {stream_name}"}, {defaultMessage: "Unsubscribe from <z-link></z-link>"},
{stream_name: sub.name}, {"z-link": () => stream_name_with_privacy_symbol_html},
), ),
html_body, html_body,
on_click: remove_user_from_private_stream, on_click: remove_user_from_private_stream,

View File

@@ -2,6 +2,7 @@ import $ from "jquery";
import _ from "lodash"; import _ from "lodash";
import render_unsubscribe_private_stream_modal from "../templates/confirm_dialog/confirm_unsubscribe_private_stream.hbs"; import render_unsubscribe_private_stream_modal from "../templates/confirm_dialog/confirm_unsubscribe_private_stream.hbs";
import render_inline_decorated_stream_name from "../templates/inline_decorated_stream_name.hbs";
import render_browse_streams_list from "../templates/stream_settings/browse_streams_list.hbs"; import render_browse_streams_list from "../templates/stream_settings/browse_streams_list.hbs";
import render_browse_streams_list_item from "../templates/stream_settings/browse_streams_list_item.hbs"; import render_browse_streams_list_item from "../templates/stream_settings/browse_streams_list_item.hbs";
import render_selected_stream_title from "../templates/stream_settings/selected_stream_title.hbs"; import render_selected_stream_title from "../templates/stream_settings/selected_stream_title.hbs";
@@ -999,6 +1000,7 @@ export function open_create_stream() {
export function unsubscribe_from_private_stream(sub) { export function unsubscribe_from_private_stream(sub) {
const invite_only = sub.invite_only; const invite_only = sub.invite_only;
const sub_count = peer_data.get_subscriber_count(sub.stream_id); const sub_count = peer_data.get_subscriber_count(sub.stream_id);
const stream_name_with_privacy_symbol_html = render_inline_decorated_stream_name({stream: sub});
const html_body = render_unsubscribe_private_stream_modal({ const html_body = render_unsubscribe_private_stream_modal({
message: $t({ message: $t({
@@ -1020,8 +1022,8 @@ export function unsubscribe_from_private_stream(sub) {
confirm_dialog.launch({ confirm_dialog.launch({
html_heading: $t_html( html_heading: $t_html(
{defaultMessage: "Unsubscribe from {stream_name}"}, {defaultMessage: "Unsubscribe from <z-link></z-link>"},
{stream_name: sub.name}, {"z-link": () => stream_name_with_privacy_symbol_html},
), ),
html_body, html_body,
on_click: unsubscribe_from_stream, on_click: unsubscribe_from_stream,