diff --git a/src/img/avatar-default-symbolic.svg b/src/img/avatar-default-symbolic.svg new file mode 100644 index 000000000..ee7e8c6b0 --- /dev/null +++ b/src/img/avatar-default-symbolic.svg @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/src/js/client.js b/src/js/client.js index 40f9723a1..2440839c0 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1805,28 +1805,29 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }); }; - Client.prototype.clearAvatar = function (callback) { - del('/api/v1/profile/avatar', {}, function (error, data, status) { - if (error) return callback(error); - if (status !== 202) return callback(new ClientError(status, data)); - callback(null); - }); - }; + Client.prototype.changeAvatar = function (avatarFileOrType, callback) { + // Blob type if object + if (typeof avatarFileOrType === 'object') { + var fd = new FormData(); + fd.append('avatar', avatarFileOrType); - Client.prototype.changeAvatar = function (avatarFile, callback) { - var fd = new FormData(); - fd.append('avatar', avatarFile); + var config = { + headers: { 'Content-Type': undefined }, + transformRequest: angular.identity + }; - var config = { - headers: { 'Content-Type': undefined }, - transformRequest: angular.identity - }; - - post('/api/v1/profile/avatar', fd, config, function (error, data, status) { - if (error) return callback(error); - if (status !== 202) return callback(new ClientError(status, data)); - callback(null); - }); + post('/api/v1/profile/avatar', fd, config, function (error, data, status) { + if (error) return callback(error); + if (status !== 202) return callback(new ClientError(status, data)); + callback(null); + }); + } else { + post('/api/v1/profile/avatar', { avatar: avatarFileOrType === 'gravatar' ? 'gravatar' : '' }, null, function (error, data, status) { + if (error) return callback(error); + if (status !== 202) return callback(new ClientError(status, data)); + callback(null); + }); + } }; Client.prototype.changePassword = function (currentPassword, newPassword, callback) { diff --git a/src/views/profile.html b/src/views/profile.html index b09e6b0c8..66bc77343 100644 --- a/src/views/profile.html +++ b/src/views/profile.html @@ -7,32 +7,39 @@ -