2014-02-12 05:23:40 -05:00
|
|
|
logger = require("logger-sharelatex")
|
|
|
|
User = require('../../models/User').User
|
|
|
|
|
|
|
|
module.exports =
|
2019-02-25 05:22:47 -05:00
|
|
|
updateFeatures: (user_id, features, callback = (err, features, featuresChanged)->)->
|
2014-02-12 05:23:40 -05:00
|
|
|
conditions = _id:user_id
|
|
|
|
update = {}
|
2018-05-16 11:31:28 -04:00
|
|
|
logger.log user_id:user_id, features:features, "updating users features"
|
|
|
|
update["features.#{key}"] = value for key, value of features
|
2019-02-25 05:22:47 -05:00
|
|
|
User.update conditions, update, (err, result)->
|
|
|
|
callback err, features, result?.nModified == 1
|
2014-02-12 05:23:40 -05:00
|
|
|
|