aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-04-03 21:24:36 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-04-03 21:24:36 +0200
commit1d49e1e27d63db1dfc9a7fd28c9902f488831a89 (patch)
treece3353ad691876c55ce8fcfdd70bfa2b9112b39a /server/controllers/api
parent31b59b477459d4f26ed8ef089a0e5553fb6a332b (diff)
downloadPeerTube-1d49e1e27d63db1dfc9a7fd28c9902f488831a89.tar.gz
PeerTube-1d49e1e27d63db1dfc9a7fd28c9902f488831a89.tar.zst
PeerTube-1d49e1e27d63db1dfc9a7fd28c9902f488831a89.zip
Server: Add NSFW in user profile
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/users.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/controllers/api/users.js b/server/controllers/api/users.js
index f854b3082..6b6c0774f 100644
--- a/server/controllers/api/users.js
+++ b/server/controllers/api/users.js
@@ -71,6 +71,7 @@ function createUser (req, res, next) {
71 username: req.body.username, 71 username: req.body.username,
72 password: req.body.password, 72 password: req.body.password,
73 email: req.body.email, 73 email: req.body.email,
74 displayNSFW: false,
74 role: constants.USER_ROLES.USER 75 role: constants.USER_ROLES.USER
75 }) 76 })
76 77
@@ -136,7 +137,9 @@ function updateUser (req, res, next) {
136 db.User.loadByUsername(res.locals.oauth.token.user.username, function (err, user) { 137 db.User.loadByUsername(res.locals.oauth.token.user.username, function (err, user) {
137 if (err) return next(err) 138 if (err) return next(err)
138 139
139 user.password = req.body.password 140 if (req.body.password) user.password = req.body.password
141 if (req.body.displayNSFW !== undefined) user.displayNSFW = req.body.displayNSFW
142
140 user.save().asCallback(function (err) { 143 user.save().asCallback(function (err) {
141 if (err) return next(err) 144 if (err) return next(err)
142 145