From e14509574d534a74fcebf9515146b028bbdec153 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 27 Sep 2019 04:58:28 +0900 Subject: AP featured collectionの修正 / Collection Activityの対応 / typeの修正など (#5460) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * resolver type / fix updateFeatured * type ApObject * fix strange type * AP Activity * Collection Activityが失敗したらとりあえず無視 --- src/remote/activitypub/models/person.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/remote/activitypub/models') diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index 780a05d262..a0b951c5f4 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -26,6 +26,8 @@ import { UserProfile } from '../../../models/entities/user-profile'; import { validActor } from '../../../remote/activitypub/type'; import { getConnection } from 'typeorm'; import { ensure } from '../../../prelude/ensure'; +import { toArray } from '../../../prelude/array'; + const logger = apLogger; /** @@ -463,8 +465,7 @@ export async function updateFeatured(userId: User['id']) { // Resolve to Object(may be Note) arrays const unresolvedItems = isCollection(collection) ? collection.items : collection.orderedItems; - const items = await resolver.resolve(unresolvedItems); - if (!Array.isArray(items)) throw new Error(`Collection items is not an array`); + const items = await Promise.all(toArray(unresolvedItems).map(x => resolver.resolve(x))); // Resolve and regist Notes const limit = promiseLimit(2); -- cgit v1.2.3-freya