1
0
Fork 1
mirror of https://example.com synced 2024-11-24 06:56:41 +09:00

Support quotes provided as 'quoteUri' field (#9399)

This commit is contained in:
Kainoa Kanter 2023-01-04 02:39:23 +00:00
commit 37117fb748
4 changed files with 5 additions and 2 deletions

View file

@ -157,7 +157,7 @@ export async function createNote(value: string | IObject, resolver?: Resolver, s
// Quote
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, s
}
};
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);

View file

@ -22,6 +22,7 @@ export const renderActivity = (x: any): IActivity | null => {
movedToUri: 'as:movedTo',
sensitive: 'as:sensitive',
Hashtag: 'as:Hashtag',
quoteUri: 'fedibird:quoteUri',
quoteUrl: 'as:quoteUrl',
// Mastodon
toot: 'http://joinmastodon.org/ns#',

View file

@ -142,6 +142,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
mediaType: "text/x.misskeymarkdown",
},
_misskey_quote: quote,
quoteUri: quote,
quoteUrl: quote,
published: note.createdAt.toISOString(),
to,

View file

@ -112,6 +112,7 @@ export interface IPost extends IObject {
};
_misskey_quote?: string;
quoteUrl?: string;
quoteUri?: string;
_misskey_talk: boolean;
}