From 325cd03a59a381c22cf5841ff995881268885ca7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 1 Nov 2018 09:08:00 +0900 Subject: [PATCH] Improve performance --- src/models/user.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/models/user.ts b/src/models/user.ts index 89af750f3..c1c42e891 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -225,6 +225,7 @@ export const pack = ( const fields = opts.detail ? { } : { + usernameLower: false, bannerColor: false, bannerUrl: false, description: false, @@ -241,7 +242,14 @@ export const pack = ( wallpaperColor: false, wallpaperId: false, wallpaperUrl: false, - twitter: false + twitter: false, + pendingReceivedFollowRequestsCount: false, + featured: false, + sharedInbox: false, + endpoints: false, + inbox: false, + twoFactorTempSecret: false, + twoFactorSecret: false }; // Populate the user if 'user' is ID @@ -276,6 +284,8 @@ export const pack = ( _user.id = _user._id; delete _user._id; + delete _user.usernameLower; + if (_user.host == null) { // Remove private properties delete _user.keypair; @@ -283,7 +293,6 @@ export const pack = ( delete _user.token; delete _user.twoFactorTempSecret; delete _user.twoFactorSecret; - delete _user.usernameLower; if (_user.twitter) { delete _user.twitter.accessToken; delete _user.twitter.accessTokenSecret;