Supports Array ActivityStreams type (#7536)

* Supports Array type

* Fix

* Fix Service to Note

* Update type.ts

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
MeiMei 2021-05-31 13:04:13 +09:00 committed by GitHub
parent b608f63a1a
commit caf40e40fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 76 additions and 82 deletions

View file

@ -1,5 +1,5 @@
import { IRemoteUser } from '../../../../models/entities/user';
import { IUpdate, validActor } from '../../type';
import { getApType, IUpdate, isActor } from '../../type';
import { apLogger } from '../../logger';
import { updateQuestion } from '../../models/question';
import Resolver from '../../resolver';
@ -22,13 +22,13 @@ export default async (actor: IRemoteUser, activity: IUpdate): Promise<string> =>
throw e;
});
if (validActor.includes(object.type)) {
if (isActor(object)) {
await updatePerson(actor.uri!, resolver, object);
return `ok: Person updated`;
} else if (object.type === 'Question') {
} else if (getApType(object) === 'Question') {
await updateQuestion(object).catch(e => console.log(e));
return `ok: Question updated`;
} else {
return `skip: Unknown type: ${object.type}`;
return `skip: Unknown type: ${getApType(object)}`;
}
};