From 9595f43d014a0170552de25e4efc744b52c6704c Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 23 Feb 2017 17:19:52 +0900 Subject: Fix bug --- src/api/endpoints/i/update.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/api/endpoints') diff --git a/src/api/endpoints/i/update.js b/src/api/endpoints/i/update.js index 5aeafa60c8..cd8f9b49d8 100644 --- a/src/api/endpoints/i/update.js +++ b/src/api/endpoints/i/update.js @@ -32,6 +32,16 @@ module.exports = async (params, user, _, isSecure) => user.name = name; } + // Get 'description' parameter + const description = params.description; + if (description !== undefined && description !== null) { + if (description.length > 500) { + return rej('too long description'); + } + + user.description = description; + } + // Get 'location' parameter const location = params.location; if (location !== undefined && location !== null) { @@ -42,16 +52,6 @@ module.exports = async (params, user, _, isSecure) => user.profile.location = location; } - // Get 'bio' parameter - const bio = params.bio; - if (bio !== undefined && bio !== null) { - if (bio.length > 500) { - return rej('too long bio'); - } - - user.profile.bio = bio; - } - // Get 'birthday' parameter const birthday = params.birthday; if (birthday != null) { @@ -79,6 +79,7 @@ module.exports = async (params, user, _, isSecure) => await User.update(user._id, { $set: { name: user.name, + description: user.description, avatar_id: user.avatar_id, banner_id: user.banner_id, profile: user.profile -- cgit v1.2.3-freya