mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
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:
committed by
Tim Abbott
parent
41fbb16cdf
commit
cc810f8951
@@ -61,13 +61,13 @@ exports.build_user_avatar_widget = function (upload_function) {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
channel.del({
|
channel.del({
|
||||||
url: '/json/users/me/avatar',
|
url: '/json/users/me/avatar',
|
||||||
success: function (data) {
|
success: function () {
|
||||||
$("#user-settings-avatar").expectOne().attr("src", data.avatar_url);
|
|
||||||
$("#user_avatar_delete_button").hide();
|
$("#user_avatar_delete_button").hide();
|
||||||
$("#user-avatar-source").show();
|
$("#user-avatar-source").show();
|
||||||
// Need to clear input because of a small edge case
|
// Need to clear input because of a small edge case
|
||||||
// where you try to upload the same image you just deleted.
|
// where you try to upload the same image you just deleted.
|
||||||
get_file_input().val('');
|
get_file_input().val('');
|
||||||
|
// Rest of the work is done via the user_events -> avatar_url event we will get
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -475,11 +475,11 @@ exports.set_up = function () {
|
|||||||
cache: false,
|
cache: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function (data) {
|
success: function () {
|
||||||
loading.destroy_indicator($("#upload_avatar_spinner"));
|
loading.destroy_indicator($("#upload_avatar_spinner"));
|
||||||
$("#user-avatar-block").expectOne().attr("src", data.avatar_url);
|
|
||||||
$("#user_avatar_delete_button").show();
|
$("#user_avatar_delete_button").show();
|
||||||
$("#user-avatar-source").hide();
|
$("#user-avatar-source").hide();
|
||||||
|
// Rest of the work is done via the user_events -> avatar_url event we will get
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
if (page_params.avatar_source === 'G') {
|
if (page_params.avatar_source === 'G') {
|
||||||
|
|||||||
Reference in New Issue
Block a user