AP featured collectionの修正 / Collection Activityの対応 / typeの修正など (#5460)

* resolver type / fix updateFeatured

* type ApObject

* fix strange type

* AP Activity

* Collection Activityが失敗したらとりあえず無視
This commit is contained in:
MeiMei
2019-09-27 04:58:28 +09:00
committed by syuilo
parent 3a093f8bd7
commit e14509574d
10 changed files with 85 additions and 106 deletions

View File

@@ -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<Note | null>(2);