mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Rename some functions related to bot avatars.
(imported from commit 6f88ee71dda263bfe7b5c15baed02aaf00d35f15)
This commit is contained in:
		@@ -15,7 +15,7 @@ function is_image_format(file) {
 | 
			
		||||
    return _.indexOf(supported_types, type) >= 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.set_up_avatar_logic_for_creating_bots = function () {
 | 
			
		||||
exports.build_bot_create_widget = function () {
 | 
			
		||||
 | 
			
		||||
    // We have to do strange gyrations with the file input to clear it,
 | 
			
		||||
    // where we replace it wholesale, so we generalize the file input with
 | 
			
		||||
@@ -29,7 +29,7 @@ exports.set_up_avatar_logic_for_creating_bots = function () {
 | 
			
		||||
    var clear_button = $('#bot_avatar_clear_button');
 | 
			
		||||
    var upload_button = $('#bot_avatar_upload_button');
 | 
			
		||||
 | 
			
		||||
    return exports.set_up_file_input(
 | 
			
		||||
    return exports.build_widget(
 | 
			
		||||
        get_file_input,
 | 
			
		||||
        file_name_field,
 | 
			
		||||
        input_error,
 | 
			
		||||
@@ -38,7 +38,7 @@ exports.set_up_avatar_logic_for_creating_bots = function () {
 | 
			
		||||
    );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.set_up_avatar_logic_for_editing_bots = function (li) {
 | 
			
		||||
exports.build_bot_edit_widget = function (li) {
 | 
			
		||||
    var get_file_input = function () {
 | 
			
		||||
        return li.find('.edit_bot_avatar_file_input');
 | 
			
		||||
    };
 | 
			
		||||
@@ -48,7 +48,7 @@ exports.set_up_avatar_logic_for_editing_bots = function (li) {
 | 
			
		||||
    var clear_button = li.find('.edit_bot_avatar_clear_button');
 | 
			
		||||
    var upload_button = li.find('.edit_bot_avatar_upload_button');
 | 
			
		||||
 | 
			
		||||
    return exports.set_up_file_input(
 | 
			
		||||
    return exports.build_widget(
 | 
			
		||||
        get_file_input,
 | 
			
		||||
        file_name_field,
 | 
			
		||||
        input_error,
 | 
			
		||||
@@ -57,7 +57,7 @@ exports.set_up_avatar_logic_for_editing_bots = function (li) {
 | 
			
		||||
    );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.set_up_file_input = function (
 | 
			
		||||
exports.build_widget = function (
 | 
			
		||||
        get_file_input, // function returns a jQuery file input object
 | 
			
		||||
        file_name_field, // jQuery object to show file name
 | 
			
		||||
        input_error, // jQuery object for error text
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ $(function () {
 | 
			
		||||
                          "Please only use characters that are valid in an email address");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    var clear_bot_avatar_file_input = avatar.set_up_avatar_logic_for_creating_bots().clear;
 | 
			
		||||
    var create_avatar_widget = avatar.build_bot_create_widget();
 | 
			
		||||
 | 
			
		||||
    $('#create_bot_form').validate({
 | 
			
		||||
        errorClass: 'text-error',
 | 
			
		||||
@@ -76,7 +76,7 @@ $(function () {
 | 
			
		||||
                    $('#create_bot_name').val('');
 | 
			
		||||
                    $('#create_bot_short_name').val('');
 | 
			
		||||
                    $('#create_bot_button').show();
 | 
			
		||||
                    clear_bot_avatar_file_input();
 | 
			
		||||
                    create_avatar_widget.clear();
 | 
			
		||||
 | 
			
		||||
                    add_bot_row(
 | 
			
		||||
                            full_name,
 | 
			
		||||
@@ -143,13 +143,13 @@ $(function () {
 | 
			
		||||
        bot_info.hide();
 | 
			
		||||
        edit_div.show();
 | 
			
		||||
 | 
			
		||||
        var avatar_handler = avatar.set_up_avatar_logic_for_editing_bots(li);
 | 
			
		||||
        var avatar_widget = avatar.build_bot_edit_widget(li);
 | 
			
		||||
 | 
			
		||||
        function show_row_again() {
 | 
			
		||||
            image.show();
 | 
			
		||||
            bot_info.show();
 | 
			
		||||
            edit_div.hide();
 | 
			
		||||
            avatar_handler.close();
 | 
			
		||||
            avatar_widget.close();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        reset_edit_bot.click(function (event) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user