activitypub: Support quoteUri for quote posts #316
4 changed files with 6 additions and 2 deletions
|
@ -157,7 +157,7 @@ export async function createNote(value: string | IObject, resolver: Resolver, si
|
|||
// 引用
|
||||
let quote: Note | undefined | null;
|
||||
|
||||
if (note._misskey_quote || note.quoteUrl) {
|
||||
if (note._misskey_quote || note.quoteUrl || note.quoteUri) {
|
||||
const tryResolveNote = async (uri: string): Promise<{
|
||||
status: 'ok';
|
||||
res: Note | null;
|
||||
|
@ -184,7 +184,7 @@ export async function createNote(value: string | IObject, resolver: Resolver, si
|
|||
}
|
||||
};
|
||||
|
||||
const uris = unique([note._misskey_quote, note.quoteUrl].filter((x): x is string => typeof x === 'string'));
|
||||
const uris = unique([note._misskey_quote, note.quoteUrl, note.quoteUri].filter((x): x is string => typeof x === 'string'));
|
||||
const results = await Promise.all(uris.map(uri => tryResolveNote(uri)));
|
||||
|
||||
quote = results.filter((x): x is { status: 'ok', res: Note | null } => x.status === 'ok').map(x => x.res).find(x => x);
|
||||
|
|
|
@ -22,6 +22,7 @@ export const renderActivity = (x: any): IActivity | null => {
|
|||
sensitive: 'as:sensitive',
|
||||
Hashtag: 'as:Hashtag',
|
||||
quoteUrl: 'as:quoteUrl',
|
||||
quoteUri: 'fedibird:quoteUri',
|
||||
// Mastodon
|
||||
toot: 'http://joinmastodon.org/ns#',
|
||||
Emoji: 'toot:Emoji',
|
||||
|
|
|
@ -142,6 +142,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
|
|||
},
|
||||
_misskey_quote: quote,
|
||||
quoteUrl: quote,
|
||||
quoteUri: quote,
|
||||
published: note.createdAt.toISOString(),
|
||||
to,
|
||||
cc,
|
||||
|
|
|
@ -112,6 +112,7 @@ export interface IPost extends IObject {
|
|||
};
|
||||
_misskey_quote?: string;
|
||||
quoteUrl?: string;
|
||||
quoteUri?: string;
|
||||
_misskey_talk: boolean;
|
||||
}
|
||||
|
||||
|
@ -123,6 +124,7 @@ export interface IQuestion extends IObject {
|
|||
};
|
||||
_misskey_quote?: string;
|
||||
quoteUrl?: string;
|
||||
quoteUri?: string;
|
||||
oneOf?: IQuestionChoice[];
|
||||
anyOf?: IQuestionChoice[];
|
||||
endTime?: Date;
|
||||
|
|
Loading…
Reference in a new issue