Have 3 explicit avatar options
custom image, gravatar or none
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user