Support quotes provided as 'quoteUri' field
This commit is contained in:
parent
f4e2e5febf
commit
1d45bdbfdc
|
@ -157,7 +157,7 @@ export async function createNote(value: string | IObject, resolver?: Resolver, s
|
||||||
// Quote
|
// Quote
|
||||||
let quote: Note | undefined | null;
|
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<{
|
const tryResolveNote = async (uri: string): Promise<{
|
||||||
status: 'ok';
|
status: 'ok';
|
||||||
res: Note | null;
|
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)));
|
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);
|
quote = results.filter((x): x is { status: 'ok', res: Note | null } => x.status === 'ok').map(x => x.res).find(x => x);
|
||||||
|
|
|
@ -112,6 +112,7 @@ export interface IPost extends IObject {
|
||||||
};
|
};
|
||||||
_misskey_quote?: string;
|
_misskey_quote?: string;
|
||||||
quoteUrl?: string;
|
quoteUrl?: string;
|
||||||
|
quoteUri?: string;
|
||||||
_misskey_talk: boolean;
|
_misskey_talk: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue