mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +00:00
stream-settings: Move update_channel_folder_name.
This commit moves update_channel_folder_name function from stream_ui_updates.ts to stream_settings_ui.ts to avoid import cycle in further commits.
This commit is contained in:
@@ -131,7 +131,7 @@ export function dispatch_normal_event(event) {
|
||||
if (event.data.name !== undefined) {
|
||||
inbox_ui.complete_rerender();
|
||||
stream_list.update_streams_sidebar();
|
||||
stream_ui_updates.update_channel_folder_name(event.channel_folder_id);
|
||||
stream_settings_ui.update_channel_folder_name(event.channel_folder_id);
|
||||
}
|
||||
|
||||
if (event.data.is_archived !== undefined) {
|
||||
|
||||
@@ -32,6 +32,7 @@ import * as resize from "./resize.ts";
|
||||
import * as scroll_util from "./scroll_util.ts";
|
||||
import * as search_util from "./search_util.ts";
|
||||
import * as settings_banner from "./settings_banner.ts";
|
||||
import * as settings_components from "./settings_components.ts";
|
||||
import * as settings_config from "./settings_config.ts";
|
||||
import * as settings_data from "./settings_data.ts";
|
||||
import {type GroupSettingValue, current_user, realm} from "./state_data.ts";
|
||||
@@ -267,6 +268,24 @@ export function update_channel_folder(sub: StreamSubscription, folder_id: number
|
||||
}
|
||||
}
|
||||
|
||||
export function update_channel_folder_name(folder_id: number): void {
|
||||
if (!overlays.streams_open()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const active_stream_id = stream_settings_components.get_active_data().id;
|
||||
if (!active_stream_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sub = sub_store.get(active_stream_id)!;
|
||||
if (sub.folder_id !== folder_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
settings_components.set_channel_folder_dropdown_value(sub);
|
||||
}
|
||||
|
||||
export function reset_dropdown_set_to_archived_folder(folder_id: number): void {
|
||||
// This function handles the case where user is in process of changing
|
||||
// folder for a channel or setting a folder for a new channel and the
|
||||
|
||||
@@ -631,24 +631,6 @@ export function update_channel_folder_dropdown(sub: StreamSubscription): void {
|
||||
settings_components.set_channel_folder_dropdown_value(sub);
|
||||
}
|
||||
|
||||
export function update_channel_folder_name(folder_id: number): void {
|
||||
if (!overlays.streams_open()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const active_stream_id = stream_settings_components.get_active_data().id;
|
||||
if (!active_stream_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sub = sub_store.get(active_stream_id)!;
|
||||
if (sub.folder_id !== folder_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
settings_components.set_channel_folder_dropdown_value(sub);
|
||||
}
|
||||
|
||||
export function maybe_reset_channel_folder_dropdown(archived_folder_id: number): void {
|
||||
const $elem = $("#id_folder_id");
|
||||
const selected_value = settings_components.get_channel_folder_value_from_dropdown_widget($elem);
|
||||
|
||||
@@ -566,7 +566,7 @@ run_test("channel_folders", ({override}) => {
|
||||
event = event_fixtures.channel_folder__update;
|
||||
{
|
||||
const stub = make_stub();
|
||||
override(stream_ui_updates, "update_channel_folder_name", stub.f);
|
||||
override(stream_settings_ui, "update_channel_folder_name", stub.f);
|
||||
override(stream_list, "update_streams_sidebar", stub.f);
|
||||
override(stream_settings_ui, "reset_dropdown_set_to_archived_folder", stub.f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user