settings: Allow uploading same image as avatar after deleting.

Previous hack wasn't working but changing the value of
file input element to empty works.
For more info https://stackoverflow.com/questions/20549241.

Fixes: #8377.
This commit is contained in:
Shubham Dhama 2018-02-14 17:12:19 +05:30 committed by Tim Abbott
parent 118dfb9690
commit 995138d730
1 changed files with 1 additions and 2 deletions

View File

@ -62,8 +62,7 @@ exports.build_user_avatar_widget = function (upload_function) {
$("#user_avatar_delete_button").hide();
// Need to clear input because of a small edge case
// where you try to upload the same image you just deleted.
var file_input = $("#user_avatar_file_input");
file_input.replaceWith(file_input.clone(true));
get_file_input().val('');
},
});
});