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_type_values: Add module for bot type constants.

Sairam Bisoyi534abb2cc8bb
diff --git a/web/src/bot_type_values.ts b/web/src/bot_type_values.ts
new file mode 100644
index 00000000000..a93e47a8ad3
--- /dev/null
+++ b/web/src/bot_type_values.ts
@@ -0,0 +1,8 @@
+// Bot type integer values from the API.
+export const GENERIC_BOT_TYPE = 1;
+export const INCOMING_WEBHOOK_BOT_TYPE_INT = 2;
+export const OUTGOING_WEBHOOK_BOT_TYPE_INT = 3;
+
+// String forms used as HTML form values.
+export const OUTGOING_WEBHOOK_BOT_TYPE = "3";
+export const EMBEDDED_BOT_TYPE = "4";
diff --git a/web/src/settings_bots.ts b/web/src/settings_bots.ts
index dd05e07d288..1bff3e00a85 100644
--- a/web/src/settings_bots.ts
+++ b/web/src/settings_bots.ts
@@ -10,6 +10,13 @@ import * as avatar from "./avatar.ts";
import * as bot_data from "./bot_data.ts";
import type {Bot} from "./bot_data.ts";
import * as bot_helper from "./bot_helper.ts";
+import {
+ EMBEDDED_BOT_TYPE,
+ GENERIC_BOT_TYPE,
+ INCOMING_WEBHOOK_BOT_TYPE_INT,
+ OUTGOING_WEBHOOK_BOT_TYPE,
+ OUTGOING_WEBHOOK_BOT_TYPE_INT,
+} from "./bot_type_values.ts";
import * as buttons from "./buttons.ts";
import * as channel from "./channel.ts";
import {csrf_token} from "./csrf.ts";
@@ -35,12 +42,6 @@ import * as user_deactivation_ui from "./user_deactivation_ui.ts";
import * as user_sort from "./user_sort.ts";
import * as util from "./util.ts";
-const GENERIC_BOT_TYPE = 1;
-const INCOMING_WEBHOOK_BOT_TYPE_INT = 2;
-const OUTGOING_WEBHOOK_BOT_TYPE = "3";
-const OUTGOING_WEBHOOK_BOT_TYPE_INT = 3;
-const EMBEDDED_BOT_TYPE = "4";
-
export const org_all_bots_list_dropdown_widget_name = "org_all_bots_list_select_bot_status";
export const org_your_bots_list_dropdown_widget_name = "org_your_bots_list_select_bot_status";
export const personal_all_bots_list_dropdown_widget_name =
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index d9f0b7f9a45..0ff22008520 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -21,6 +21,11 @@ import * as avatar from "./avatar.ts";
import * as banners from "./banners.ts";
import * as bot_data from "./bot_data.ts";
import * as bot_helper from "./bot_helper.ts";
+import {
+ EMBEDDED_BOT_TYPE,
+ INCOMING_WEBHOOK_BOT_TYPE_INT,
+ OUTGOING_WEBHOOK_BOT_TYPE,
+} from "./bot_type_values.ts";
import * as browser_history from "./browser_history.ts";
import * as buddy_data from "./buddy_data.ts";
import * as buttons from "./buttons.ts";
@@ -93,10 +98,6 @@ let toggler: components.Toggle;
let bot_owner_dropdown_widget: DropdownWidget | undefined;
let original_values: (Record<string, unknown> & {user_id?: string | undefined}) | undefined;
-const INCOMING_WEBHOOK_BOT_TYPE_INT = 2;
-const OUTGOING_WEBHOOK_BOT_TYPE = "3";
-const EMBEDDED_BOT_TYPE = "4";
-
export function show_button_spinner($button: JQuery): void {
const $spinner = $button.find(".modal__spinner");
$button.prop("disabled", true);