From 26c9d8ff6fbc2fc0dd329f5de83ce05b57b426ad Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 31 Oct 2018 11:20:54 +0900 Subject: [PATCH] Clean up --- src/models/blocking.ts | 4 ++-- src/models/drive-file.ts | 2 +- src/models/favorite.ts | 2 +- src/models/mute.ts | 4 ++-- src/models/note.ts | 2 +- src/models/notification.ts | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/models/blocking.ts b/src/models/blocking.ts index 3eace3989a..02369e4036 100644 --- a/src/models/blocking.ts +++ b/src/models/blocking.ts @@ -2,7 +2,7 @@ import * as mongo from 'mongodb'; import db from '../db/mongodb'; import isObjectId from '../misc/is-objectid'; const deepcopy = require('deepcopy'); -import { pack as packUser } from './user'; +import { pack as packUser, IUser } from './user'; const Blocking = db.get('blocking'); Blocking.createIndex('blockerId'); @@ -21,7 +21,7 @@ export const packMany = async ( blockings: (string | mongo.ObjectID | IBlocking)[], me?: string | mongo.ObjectID | IUser ) => { - return (await Promise.all(blockings.map(x => pack(x, me)))).filter(x => x != null); + return (await Promise.all(blockings.map(x => pack(x, me)))); }; export const pack = ( diff --git a/src/models/drive-file.ts b/src/models/drive-file.ts index ecbf279d03..8afd170eec 100644 --- a/src/models/drive-file.ts +++ b/src/models/drive-file.ts @@ -79,7 +79,7 @@ export const packMany = async ( detail: boolean } ) => { - return (await Promise.all(files.map(f => pack(f, options)))).filter(x => x != null); + return (await Promise.all(files.map(f => pack(f, options)))); }; /** diff --git a/src/models/favorite.ts b/src/models/favorite.ts index 5f3c328eb1..909d4b932e 100644 --- a/src/models/favorite.ts +++ b/src/models/favorite.ts @@ -20,7 +20,7 @@ export const packMany = async ( favorites: any[], me: any ) => { - return (await Promise.all(favorites.map(f => pack(f, me)))).filter(x => x != null); + return (await Promise.all(favorites.map(f => pack(f, me)))); }; /** diff --git a/src/models/mute.ts b/src/models/mute.ts index 58536d4b9c..3d8feda395 100644 --- a/src/models/mute.ts +++ b/src/models/mute.ts @@ -2,7 +2,7 @@ import * as mongo from 'mongodb'; import db from '../db/mongodb'; import isObjectId from '../misc/is-objectid'; const deepcopy = require('deepcopy'); -import { pack as packUser } from './user'; +import { pack as packUser, IUser } from './user'; const Mute = db.get('mute'); Mute.createIndex('muterId'); @@ -21,7 +21,7 @@ export const packMany = async ( mutes: (string | mongo.ObjectID | IMute)[], me?: string | mongo.ObjectID | IUser ) => { - return (await Promise.all(mutes.map(x => pack(x, me)))).filter(x => x != null); + return (await Promise.all(mutes.map(x => pack(x, me)))); }; export const pack = ( diff --git a/src/models/note.ts b/src/models/note.ts index bc1d6b0ec7..18fc0874dd 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -172,7 +172,7 @@ export const packMany = async ( skipHide?: boolean; } ) => { - return (await Promise.all(notes.map(n => pack(n, me, options)))).filter(x => x != null); + return (await Promise.all(notes.map(n => pack(n, me, options)))); }; /** diff --git a/src/models/notification.ts b/src/models/notification.ts index 34629ade0c..3944395baf 100644 --- a/src/models/notification.ts +++ b/src/models/notification.ts @@ -54,7 +54,7 @@ export interface INotification { export const packMany = async ( notifications: any[] ) => { - return (await Promise.all(notifications.map(n => pack(n)))).filter(x => x != null); + return (await Promise.all(notifications.map(n => pack(n)))); }; /**