Skip to content
Snippets Groups Projects
Commit cf424cb6 authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Settings: unset section if none is given on update

parent efa474c9
No related branches found
No related tags found
No related merge requests found
...@@ -35,12 +35,18 @@ RocketChat.settings.add = (_id, value, options = {}) -> ...@@ -35,12 +35,18 @@ RocketChat.settings.add = (_id, value, options = {}) ->
if not options.i18nDescription? if not options.i18nDescription?
options.i18nDescription = "#{_id}_Description" options.i18nDescription = "#{_id}_Description"
return RocketChat.models.Settings.upsert { _id: _id }, updateOperations =
$set: options $set: options
$setOnInsert: $setOnInsert:
value: value value: value
createdAt: new Date createdAt: new Date
if not options.section?
updateOperations.$unset = { section: 1 }
return RocketChat.models.Settings.upsert { _id: _id }, updateOperations
### ###
# Add a setting group # Add a setting group
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment