mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-02 06:15:54 +02:00
Fix: AP object / actor type (#5086)
* attributedToがArrayの場合などに対応 * attachment以外で来るDocument系のObjectに対応 * Renote, Reply 対応 * 表示をいい感じに * fix type * revert as const * Fix Note / Question type * attributedToのtypeで複合配列を想定する
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
import config from '../../../config';
|
||||
import Resolver from '../resolver';
|
||||
import { IQuestion } from '../type';
|
||||
import { IObject, IQuestion, isQuestion, } from '../type';
|
||||
import { apLogger } from '../logger';
|
||||
import { Notes, Polls } from '../../../models';
|
||||
import { IPoll } from '../../../models/entities/poll';
|
||||
|
||||
export async function extractPollFromQuestion(source: string | IQuestion): Promise<IPoll> {
|
||||
const question = typeof source === 'string' ? await new Resolver().resolve(source) as IQuestion : source;
|
||||
export async function extractPollFromQuestion(source: string | IObject, resolver?: Resolver): Promise<IPoll> {
|
||||
if (resolver == null) resolver = new Resolver();
|
||||
|
||||
const question = await resolver.resolve(source);
|
||||
|
||||
if (!isQuestion(question)) {
|
||||
throw new Error('invalid type');
|
||||
}
|
||||
|
||||
const multiple = !question.oneOf;
|
||||
const expiresAt = question.endTime ? new Date(question.endTime) : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user