user settings: Display avatar source.

This makes it easier for users to tell how Zulip ended up with an
avatar for them without them uploading one: through the Gravatar
service used across many Wordpress blogs.

Fixes #8225.
This commit is contained in:
Rhea Parekh
2018-03-02 23:03:20 +05:30
committed by Tim Abbott
parent 9eeb1c59f6
commit 416f11030f
4 changed files with 40 additions and 3 deletions

View File

@@ -51,7 +51,11 @@ exports.build_user_avatar_widget = function (upload_function) {
if (page_params.avatar_source === 'G') {
$("#user_avatar_delete_button").hide();
$("#user-avatar-source").show();
} else {
$("#user-avatar-source").hide();
}
$("#user_avatar_delete_button").on('click', function (e) {
e.preventDefault();
e.stopPropagation();
@@ -60,6 +64,7 @@ exports.build_user_avatar_widget = function (upload_function) {
success: function (data) {
$("#user-settings-avatar").expectOne().attr("src", data.avatar_url);
$("#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('');