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
10 changed files with 76 additions and 82 deletions

View File

@@ -17,7 +17,7 @@ import { deliverQuestionUpdate } from '../../../services/note/polls/update';
import { extractDbHost, toPuny } from '@/misc/convert-host';
import { Emojis, Polls, MessagingMessages } from '../../../models';
import { Note } from '../../../models/entities/note';
import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji } from '../type';
import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji, getApType } from '../type';
import { Emoji } from '../../../models/entities/emoji';
import { genId } from '@/misc/gen-id';
import { fetchMeta } from '@/misc/fetch-meta';
@@ -36,8 +36,8 @@ export function validateNote(object: any, uri: string) {
return new Error('invalid Note: object is null');
}
if (!validPost.includes(object.type)) {
return new Error(`invalid Note: invalid object type ${object.type}`);
if (!validPost.includes(getApType(object))) {
return new Error(`invalid Note: invalid object type ${getApType(object)}`);
}
if (object.id && extractDbHost(object.id) !== expectHost) {