mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	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:
		@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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));
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user