settings: Fix width not maximum while uploading user avatar.

New user avatar width is not maximum when user upload
new image. Because wrong html element is accessed for
setting value of image src attribute.
This commit removes these code from success of ajax call,
cause we already handle this in event `user_events - avatar_url`.
This commit is contained in:
Yashashvi Dave
2018-10-18 13:34:43 +05:30
committed by Tim Abbott
parent 41fbb16cdf
commit cc810f8951
2 changed files with 4 additions and 4 deletions

View File

@@ -61,13 +61,13 @@ exports.build_user_avatar_widget = function (upload_function) {
e.stopPropagation();
channel.del({
url: '/json/users/me/avatar',
success: function (data) {
$("#user-settings-avatar").expectOne().attr("src", data.avatar_url);
success: function () {
$("#user_avatar_delete_button").hide();
$("#user-avatar-source").show();
// Need to clear input because of a small edge case
// where you try to upload the same image you just deleted.
get_file_input().val('');
// Rest of the work is done via the user_events -> avatar_url event we will get
},
});
});

View File

@@ -475,11 +475,11 @@ exports.set_up = function () {
cache: false,
processData: false,
contentType: false,
success: function (data) {
success: function () {
loading.destroy_indicator($("#upload_avatar_spinner"));
$("#user-avatar-block").expectOne().attr("src", data.avatar_url);
$("#user_avatar_delete_button").show();
$("#user-avatar-source").hide();
// Rest of the work is done via the user_events -> avatar_url event we will get
},
error: function () {
if (page_params.avatar_source === 'G') {