stream-settings: Fix live update of subscribers UI.

Changes done here are -

- Previously the pill input, "Add" button and tooltip shown
when user did not have permission were not live updated when
updating can_add_subscribers_group and can_subscribe_group
stream level settings or can_add_subscribers_group realm
level setting. This commit fixes that.

- Also, when the UI was live updated to give user permission
to subscribe others, "Add" button was enabled even when
input was empty. This is also fixed in this commit.
This commit is contained in:
Sahil Batra
2025-05-01 21:22:52 +05:30
committed by Tim Abbott
parent ad5d4f4494
commit 1af039d87b
6 changed files with 51 additions and 4 deletions

View File

@@ -76,6 +76,8 @@ import * as stream_data from "./stream_data.ts";
import * as stream_events from "./stream_events.ts";
import * as stream_list from "./stream_list.ts";
import * as stream_list_sort from "./stream_list_sort.ts";
import * as stream_settings_components from "./stream_settings_components.ts";
import * as stream_settings_data from "./stream_settings_data.ts";
import * as stream_settings_ui from "./stream_settings_ui.ts";
import * as stream_topic_history from "./stream_topic_history.ts";
import * as stream_ui_updates from "./stream_ui_updates.ts";
@@ -362,6 +364,20 @@ export function dispatch_normal_event(event) {
if (key === "plan_type") {
gear_menu.rerender();
}
if (
key === "can_add_subscribers_group" &&
overlays.streams_open()
) {
const active_stream_id =
stream_settings_components.get_active_data().id;
if (active_stream_id !== undefined) {
const slim_sub = sub_store.get(active_stream_id);
const sub =
stream_settings_data.get_sub_for_settings(slim_sub);
stream_ui_updates.update_add_subscriptions_elements(sub);
}
}
}
if (event.data.authentication_methods !== undefined) {
settings_org.populate_auth_methods(