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.

bot_data: Fix `owner_id` field to allow null value.

Junyao Chen5efe78205dd9
diff --git a/web/src/bot_data.ts b/web/src/bot_data.ts
index 3fceb5a8bf1..c457577a7d8 100644
--- a/web/src/bot_data.ts
+++ b/web/src/bot_data.ts
@@ -26,7 +26,7 @@ const basic_bot_schema = z.object({
email: z.string(),
full_name: z.string(),
is_active: z.boolean(),
- owner_id: z.number(),
+ owner_id: z.number().nullable(),
user_id: z.number(),
});
@@ -90,7 +90,7 @@ export function update(bot_id: number, bot_update: ServerUpdateBotData): void {
export function get_all_bots_for_current_user(): Bot[] {
const ret = [];
for (const bot of bots.values()) {
- if (people.is_my_user_id(bot.owner_id)) {
+ if (bot.owner_id !== null && people.is_my_user_id(bot.owner_id)) {
ret.push(bot);
}
}
@@ -100,7 +100,7 @@ export function get_all_bots_for_current_user(): Bot[] {
export function get_editable(): Bot[] {
const ret = [];
for (const bot of bots.values()) {
- if (bot.is_active && people.is_my_user_id(bot.owner_id)) {
+ if (bot.is_active && bot.owner_id !== null && people.is_my_user_id(bot.owner_id)) {
ret.push(bot);
}
}