Skip to content

Commit

Permalink
Add method to reset avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Jun 2, 2015
1 parent aa5d636 commit 6ab6145
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server/methods/setAvatarFromService.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ Meteor.methods
Avatars.insert file, (err, fileObj) ->
Meteor.users.update {_id: user._id}, {$set: {avatarOrigin: service}}


resetAvatar: (image, service) ->
if not Meteor.userId()
throw new Meteor.Error 203, '[methods] typingStatus -> Usuário não logado'

user = Meteor.user()

Avatars.remove {'copies.avatars.name': user.username}

Meteor.users.update user._id, {$unset: {avatarOrigin: 1}}

0 comments on commit 6ab6145

Please sign in to comment.