The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/server/methods/resetAvatar.coffee

15 lines
481 B

Meteor.methods
resetAvatar: (image, service) ->
unless Meteor.userId()
throw new Meteor.Error(403, "[methods] resetAvatar -> Invalid user")
console.log '[methods] resetAvatar -> '.green, 'userId:', Meteor.userId(), 'arguments:', arguments
user = Meteor.user()
RocketChatFileAvatarInstance.deleteFile "#{user.username}.jpg"
RocketChat.models.Users.unsetAvatarOrigin user._id
RocketChat.Notifications.notifyAll 'updateAvatar', {username: user.username}
return