From 17c9a9374d939155e016982481807052596e30e0 Mon Sep 17 00:00:00 2001
From: Johann150 <johann.galle@protonmail.com>
Date: Sun, 19 Feb 2023 19:41:11 +0100
Subject: [PATCH] fixup: server: parse quote tag syntax

This is a fixup for commit 5893a44ff58b1cd6ea5eb032ff7bc950a30d0eab.
---
 packages/backend/src/remote/activitypub/models/note.ts | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts
index d7adc7b67..f2a82c5ae 100644
--- a/packages/backend/src/remote/activitypub/models/note.ts
+++ b/packages/backend/src/remote/activitypub/models/note.ts
@@ -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');
 		}
 	}