Settings: unset section if none is given on update

pull/1800/head
Marcelo Schmidt 10 years ago
parent efa474c935
commit cf424cb67e
  1. 8
      packages/rocketchat-lib/server/functions/settings.coffee

@ -35,12 +35,18 @@ RocketChat.settings.add = (_id, value, options = {}) ->
if not options.i18nDescription?
options.i18nDescription = "#{_id}_Description"
return RocketChat.models.Settings.upsert { _id: _id },
updateOperations =
$set: options
$setOnInsert:
value: value
createdAt: new Date
if not options.section?
updateOperations.$unset = { section: 1 }
return RocketChat.models.Settings.upsert { _id: _id }, updateOperations
###
# Add a setting group

Loading…
Cancel
Save