summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-06-02 16:27:24 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-06-02 16:27:24 +0900
commit60a7f7f1463135939440dce7f5fd03467d3e2183 (patch)
tree64b85182bda355f983cd7d76a5895e6f242f0c10 /src/server/api/endpoints
parentwip (diff)
downloadsharkey-60a7f7f1463135939440dce7f5fd03467d3e2183.tar.gz
sharkey-60a7f7f1463135939440dce7f5fd03467d3e2183.tar.bz2
sharkey-60a7f7f1463135939440dce7f5fd03467d3e2183.zip
wip
Diffstat (limited to 'src/server/api/endpoints')
-rw-r--r--src/server/api/endpoints/i/update.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts
index 5aff6da103..b94f073d2c 100644
--- a/src/server/api/endpoints/i/update.ts
+++ b/src/server/api/endpoints/i/update.ts
@@ -28,22 +28,22 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
// Get 'location' parameter
const [location, locationErr] = $.str.optional().nullable().pipe(isValidLocation).get(params.location);
if (locationErr) return rej('invalid location param');
- if (location !== undefined) updates.profile.location = location;
+ if (location !== undefined) updates['profile.location'] = location;
// Get 'birthday' parameter
const [birthday, birthdayErr] = $.str.optional().nullable().pipe(isValidBirthday).get(params.birthday);
if (birthdayErr) return rej('invalid birthday param');
- if (birthday !== undefined) updates.profile.birthday = birthday;
+ if (birthday !== undefined) updates['profile.birthday'] = birthday;
// Get 'avatarId' parameter
- const [avatarId, avatarIdErr] = $.type(ID).optional().get(params.avatarId);
+ const [avatarId, avatarIdErr] = $.type(ID).optional().nullable().get(params.avatarId);
if (avatarIdErr) return rej('invalid avatarId param');
- if (avatarId) updates.avatarId = avatarId;
+ if (avatarId !== undefined) updates.avatarId = avatarId;
// Get 'bannerId' parameter
- const [bannerId, bannerIdErr] = $.type(ID).optional().get(params.bannerId);
+ const [bannerId, bannerIdErr] = $.type(ID).optional().nullable().get(params.bannerId);
if (bannerIdErr) return rej('invalid bannerId param');
- if (bannerId) updates.bannerId = bannerId;
+ if (bannerId !== undefined) updates.bannerId = bannerId;
// Get 'isLocked' parameter
const [isLocked, isLockedErr] = $.bool.optional().get(params.isLocked);
@@ -63,7 +63,7 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
// Get 'autoWatch' parameter
const [autoWatch, autoWatchErr] = $.bool.optional().get(params.autoWatch);
if (autoWatchErr) return rej('invalid autoWatch param');
- if (autoWatch != null) updates.settings.autoWatch = autoWatch;
+ if (autoWatch != null) updates['settings.autoWatch'] = autoWatch;
if (avatarId) {
const avatar = await DriveFile.findOne({
@@ -90,7 +90,7 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
});
// Serialize
- const iObj = await pack(user, user, {
+ const iObj = await pack(user._id, user, {
detail: true,
includeSecrets: isSecure
});
@@ -98,7 +98,7 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
// Send response
res(iObj);
- // Publish i updated event
+ // Publish meUpdated event
event(user._id, 'meUpdated', iObj);
// 鍵垢を解除したとき、溜まっていたフォローリクエストがあるならすべて承認