Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stream_create: Do not create with pending text in pill widget.

Shubham Padiaf2a22b498e5d
diff --git a/web/src/stream_create.ts b/web/src/stream_create.ts
index 332de7e445b..ef0fa667670 100644
--- a/web/src/stream_create.ts
+++ b/web/src/stream_create.ts
@@ -581,6 +581,19 @@ export function set_up_handlers(): void {
stream_subscription_error.report_no_subs_to_stream();
return;
}
+
+ assert(stream_create_subscribers.pill_widget !== undefined);
+ assert(stream_create_subscribers.pill_widget !== null);
+ if (stream_create_subscribers.pill_widget.is_pending()) {
+ // We are not appending any value here, but instead this is
+ // a proxy to invoke the error state for a group widget
+ // that would usually get triggered on pressing enter.
+ stream_create_subscribers.pill_widget.appendValue(
+ stream_create_subscribers.pill_widget.getCurrentText()!,
+ );
+ return;
+ }
+
if (!principals.includes(people.my_current_user_id()) && !current_user.is_admin) {
stream_subscription_error.cant_create_stream_without_subscribing();
return;
diff --git a/web/src/stream_create_subscribers.ts b/web/src/stream_create_subscribers.ts
index 580d1eddbd1..83c88ec7981 100644
--- a/web/src/stream_create_subscribers.ts
+++ b/web/src/stream_create_subscribers.ts
@@ -12,7 +12,7 @@ import * as stream_create_subscribers_data from "./stream_create_subscribers_dat
import type {CombinedPillContainer} from "./typeahead_helper.ts";
import * as user_sort from "./user_sort.ts";
-let pill_widget: CombinedPillContainer;
+export let pill_widget: CombinedPillContainer;
let all_users_list_widget: ListWidgetType<number, people.User>;
export function get_principals(): number[] {