Better response

This commit is contained in:
syuilo 2019-04-17 02:51:12 +09:00
parent f38ab0b973
commit a9025aea0d
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
1 changed files with 7 additions and 5 deletions

View File

@ -84,6 +84,8 @@ export class UserRepository extends Repository<User> {
const pins = opts.detail ? await UserNotePinings.find({ userId: user.id }) : []; const pins = opts.detail ? await UserNotePinings.find({ userId: user.id }) : [];
const profile = opts.detail ? await UserProfiles.findOne({ userId: user.id }).then(ensure) : null; const profile = opts.detail ? await UserProfiles.findOne({ userId: user.id }).then(ensure) : null;
const falsy = opts.detail ? false : undefined;
return await rap({ return await rap({
id: user.id, id: user.id,
name: user.name, name: user.name,
@ -91,10 +93,10 @@ export class UserRepository extends Repository<User> {
host: user.host, host: user.host,
avatarUrl: user.avatarUrl ? user.avatarUrl : config.url + '/avatar/' + user.id, avatarUrl: user.avatarUrl ? user.avatarUrl : config.url + '/avatar/' + user.id,
avatarColor: user.avatarColor, avatarColor: user.avatarColor,
isAdmin: user.isAdmin || undefined, isAdmin: user.isAdmin || falsy,
isBot: user.isBot || undefined, isBot: user.isBot || falsy,
isCat: user.isCat || undefined, isCat: user.isCat || falsy,
isVerified: user.isVerified || undefined, isVerified: user.isVerified || falsy,
// カスタム絵文字添付 // カスタム絵文字添付
emojis: user.emojis.length > 0 ? Emojis.find({ emojis: user.emojis.length > 0 ? Emojis.find({
@ -123,7 +125,7 @@ export class UserRepository extends Repository<User> {
bannerUrl: user.bannerUrl, bannerUrl: user.bannerUrl,
bannerColor: user.bannerColor, bannerColor: user.bannerColor,
isLocked: user.isLocked, isLocked: user.isLocked,
isModerator: user.isModerator || undefined, isModerator: user.isModerator || falsy,
description: profile!.description, description: profile!.description,
location: profile!.location, location: profile!.location,
birthday: profile!.birthday, birthday: profile!.birthday,