mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
stream_create: Do not show banner if the current user is subscribed.
There is no need to show the banner if the user creating the channel is subscribed to it because user will eventually be narrowed to channel narrow and seeing the banner flash doesn't look good.
This commit is contained in:
@@ -22,6 +22,9 @@ import * as ui_report from "./ui_report";
|
||||
import * as util from "./util";
|
||||
|
||||
let created_stream: string | undefined;
|
||||
// Default is true since the current user is added to
|
||||
// the subscribers list initially.
|
||||
let current_user_subscribed_to_created_stream = true;
|
||||
|
||||
export function reset_created_stream(): void {
|
||||
created_stream = undefined;
|
||||
@@ -35,6 +38,18 @@ export function get_name(): string | undefined {
|
||||
return created_stream;
|
||||
}
|
||||
|
||||
export function reset_current_user_subscribed_to_created_stream(): void {
|
||||
current_user_subscribed_to_created_stream = true;
|
||||
}
|
||||
|
||||
export function set_current_user_subscribed_to_created_stream(is_subscribed: boolean): void {
|
||||
current_user_subscribed_to_created_stream = is_subscribed;
|
||||
}
|
||||
|
||||
export function get_current_user_subscribed_to_created_stream(): boolean {
|
||||
return current_user_subscribed_to_created_stream;
|
||||
}
|
||||
|
||||
export function set_first_stream_created_modal_shown(): void {
|
||||
onboarding_steps.post_onboarding_step_as_read("first_stream_created_banner");
|
||||
}
|
||||
@@ -317,6 +332,7 @@ function create_stream(): void {
|
||||
// once we upgrade the backend to accept user_ids.
|
||||
const user_ids = stream_create_subscribers.get_principals();
|
||||
const principals = JSON.stringify(user_ids);
|
||||
set_current_user_subscribed_to_created_stream(user_ids.includes(current_user.user_id));
|
||||
|
||||
assert(stream_settings_components.new_stream_can_remove_subscribers_group_widget !== null);
|
||||
const widget_value =
|
||||
|
||||
Reference in New Issue
Block a user