settings_data: Rename type_id_to_string to bot_type_id_to_string.

This commit renames type_id_to_string to bot_type_id_to_string
which is a much better name and explains the use of function
in a better way.
This commit is contained in:
Sahil Batra 2023-09-26 09:22:27 +05:30 committed by Tim Abbott
parent ede7f62781
commit 8852c4b7af
5 changed files with 7 additions and 7 deletions

View File

@ -68,7 +68,7 @@ export function render_bots() {
name: elem.full_name,
email: elem.email,
user_id: elem.user_id,
type: settings_data.type_id_to_string(elem.bot_type),
type: settings_data.bot_type_id_to_string(elem.bot_type),
avatar_url: elem.avatar_url,
api_key: elem.api_key,
is_active: elem.is_active,

View File

@ -254,7 +254,7 @@ export function user_email_not_configured(): boolean {
return page_params.is_owner && page_params.delivery_email === "";
}
export function type_id_to_string(type_id: number): string | undefined {
export function bot_type_id_to_string(type_id: number): string | undefined {
const bot_type = page_params.bot_types.find((bot_type) => bot_type.type_id === type_id);
if (bot_type === undefined) {

View File

@ -237,7 +237,7 @@ function bot_info(bot_user_id) {
info.user_role_text = people.get_user_type(bot_user_id);
// Convert bot type id to string for viewing to the users.
info.bot_type = settings_data.type_id_to_string(bot_user.bot_type);
info.bot_type = settings_data.bot_type_id_to_string(bot_user.bot_type);
info.bot_owner_full_name = bot_owner_full_name(owner_id);

View File

@ -349,7 +349,7 @@ export function show_user_profile(user, default_tab_key = "profile-tab") {
const bot_owner = people.get_by_user_id(bot_owner_id);
args.bot_owner = bot_owner;
}
args.bot_type = settings_data.type_id_to_string(user.bot_type);
args.bot_type = settings_data.bot_type_id_to_string(user.bot_type);
}
$("#user-profile-modal-holder").html(render_user_profile_modal(args));

View File

@ -419,7 +419,7 @@ run_test("type_id_to_string", () => {
},
];
assert.equal(settings_data.type_id_to_string(1), "Generic bot");
assert.equal(settings_data.type_id_to_string(2), "Incoming webhook");
assert.equal(settings_data.type_id_to_string(5), undefined);
assert.equal(settings_data.bot_type_id_to_string(1), "Generic bot");
assert.equal(settings_data.bot_type_id_to_string(2), "Incoming webhook");
assert.equal(settings_data.bot_type_id_to_string(5), undefined);
});