stream-settings: Refactor code to pass sub object to title template.

This commit refactors the code to directly pass sub object to
selected_stream_title template instead of passing name, is_web_public
and invite_only as different parameters.
This commit is contained in:
Sahil Batra 2022-01-28 16:00:48 +05:30 committed by Tim Abbott
parent 5688d8b0df
commit 12efde8a51
3 changed files with 6 additions and 11 deletions

View File

@ -138,7 +138,7 @@ export function open_edit_panel_for_row(stream_row) {
const sub = get_sub_for_target(stream_row);
$(".stream-row.active").removeClass("active");
stream_settings_ui.show_subs_pane.settings(sub.name, sub.invite_only, sub.is_web_public);
stream_settings_ui.show_subs_pane.settings(sub);
$(stream_row).addClass("active");
setup_subscriptions_stream_hash(sub);
setup_stream_settings(stream_row);

View File

@ -45,16 +45,10 @@ export const show_subs_pane = {
$(".nothing-selected").show();
$("#subscription_overlay .stream-info-title").text($t({defaultMessage: "Stream settings"}));
},
settings(stream_name, invite_only, is_web_public) {
settings(sub) {
$(".settings, #stream-creation").hide();
$(".settings").show();
$("#subscription_overlay .stream-info-title").html(
render_selected_stream_title({
stream_name,
invite_only,
is_web_public,
}),
);
$("#subscription_overlay .stream-info-title").html(render_selected_stream_title(sub));
},
create_stream() {
$(".nothing-selected, .settings, #stream-creation").hide();

View File

@ -1,4 +1,5 @@
{{> stream_privacy_icon
invite_only=invite_only
is_web_public=is_web_public }}
<span class="stream-name-title">{{stream_name}}</span>
is_web_public=is_web_public
color="#000000" }}
<span class="stream-name-title">{{name}}</span>