Improve error handling of pack function of notification

This commit is contained in:
syuilo 2018-10-04 13:53:48 +09:00
parent 35489ef5b7
commit fce7dc0f4e
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
3 changed files with 15 additions and 3 deletions

View file

@ -1,7 +1,7 @@
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Notification from '../../../../models/notification';
import Mute from '../../../../models/mute';
import { pack } from '../../../../models/notification';
import { packMany } from '../../../../models/notification';
import { getFriendIds } from '../../common/get-friends';
import read from '../../common/read-notification';
import { ILocalUser } from '../../../../models/user';
@ -83,7 +83,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
});
// Serialize
res(await Promise.all(notifications.map(notification => pack(notification))));
res(await packMany(notifications));
// Mark all as read
if (notifications.length > 0 && markAsRead) {