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/saveUserPreferences.coffee

22 lines
813 B

Meteor.methods
saveUserPreferences: (settings) ->
console.log '[method] saveUserPreferences', settings
if Meteor.userId()
preferences = {}
if settings.disableNewRoomNotification?
preferences.disableNewRoomNotification = if settings.disableNewRoomNotification is "1" then true else false
if settings.disableNewMessageNotification?
preferences.disableNewMessageNotification = if settings.disableNewMessageNotification is "1" then true else false
if settings.useEmojis?
preferences.useEmojis = if settings.useEmojis is "1" then true else false
if settings.convertAsciiEmoji?
preferences.convertAsciiEmoji = if settings.convertAsciiEmoji is "1" then true else false
Meteor.users.update Meteor.userId(), { $set: { "settings.preferences": preferences } }
return true