1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-27 22:38:30 +09:00
This commit is contained in:
syuilo 2018-06-02 16:27:24 +09:00
parent 897f7a031d
commit 60a7f7f146

View File

@ -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);
// 鍵垢を解除したとき、溜まっていたフォローリクエストがあるならすべて承認