fixup: server: parse quote tag syntax

This is a fixup for commit 5893a44ff5.
This commit is contained in:
Johann150 2023-02-19 19:41:11 +01:00
parent f207d839c4
commit 17c9a9374d
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -185,6 +185,7 @@ export async function createNote(value: string | IObject, resolver: Resolver, si
};
const uris = unique([quoteUrl, note._misskey_quote, note.quoteUri].filter((x): x is string => typeof x === 'string'));
let temperror = false;
// check the urls sequentially and abort early to not do unnecessary HTTP requests
// picks the first one that works
for (const uri in uris) {
@ -192,12 +193,13 @@ export async function createNote(value: string | IObject, resolver: Resolver, si
if (res.status === 'ok') {
quote = res.res;
break;
} else if (res.status === 'temperror) {
temperror = true;
}
}
if (!quote) {
if (results.some(x => x.status === 'temperror')) {
throw new Error('quote resolve failed');
}
if (!quote && temperror) {
// could not resolve quote, try again later
throw new Error('quote resolve failed');
}
}