1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-03 01:08:57 +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 // Get 'location' parameter
const [location, locationErr] = $.str.optional().nullable().pipe(isValidLocation).get(params.location); const [location, locationErr] = $.str.optional().nullable().pipe(isValidLocation).get(params.location);
if (locationErr) return rej('invalid location param'); if (locationErr) return rej('invalid location param');
if (location !== undefined) updates.profile.location = location; if (location !== undefined) updates['profile.location'] = location;
// Get 'birthday' parameter // Get 'birthday' parameter
const [birthday, birthdayErr] = $.str.optional().nullable().pipe(isValidBirthday).get(params.birthday); const [birthday, birthdayErr] = $.str.optional().nullable().pipe(isValidBirthday).get(params.birthday);
if (birthdayErr) return rej('invalid birthday param'); if (birthdayErr) return rej('invalid birthday param');
if (birthday !== undefined) updates.profile.birthday = birthday; if (birthday !== undefined) updates['profile.birthday'] = birthday;
// Get 'avatarId' parameter // 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 (avatarIdErr) return rej('invalid avatarId param');
if (avatarId) updates.avatarId = avatarId; if (avatarId !== undefined) updates.avatarId = avatarId;
// Get 'bannerId' parameter // 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 (bannerIdErr) return rej('invalid bannerId param');
if (bannerId) updates.bannerId = bannerId; if (bannerId !== undefined) updates.bannerId = bannerId;
// Get 'isLocked' parameter // Get 'isLocked' parameter
const [isLocked, isLockedErr] = $.bool.optional().get(params.isLocked); 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 // Get 'autoWatch' parameter
const [autoWatch, autoWatchErr] = $.bool.optional().get(params.autoWatch); const [autoWatch, autoWatchErr] = $.bool.optional().get(params.autoWatch);
if (autoWatchErr) return rej('invalid autoWatch param'); if (autoWatchErr) return rej('invalid autoWatch param');
if (autoWatch != null) updates.settings.autoWatch = autoWatch; if (autoWatch != null) updates['settings.autoWatch'] = autoWatch;
if (avatarId) { if (avatarId) {
const avatar = await DriveFile.findOne({ const avatar = await DriveFile.findOne({
@ -90,7 +90,7 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
}); });
// Serialize // Serialize
const iObj = await pack(user, user, { const iObj = await pack(user._id, user, {
detail: true, detail: true,
includeSecrets: isSecure includeSecrets: isSecure
}); });
@ -98,7 +98,7 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
// Send response // Send response
res(iObj); res(iObj);
// Publish i updated event // Publish meUpdated event
event(user._id, 'meUpdated', iObj); event(user._id, 'meUpdated', iObj);
// 鍵垢を解除したとき、溜まっていたフォローリクエストがあるならすべて承認 // 鍵垢を解除したとき、溜まっていたフォローリクエストがあるならすべて承認