From ae91ffbb8a00232e4085e91ffd43003d4a183981 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 1 Oct 2023 13:58:12 +0200 Subject: [PATCH] [mastodon-client] Fix resolving remote users that aren't yet in the database --- packages/backend/src/server/api/mastodon/helpers/search.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/helpers/search.ts b/packages/backend/src/server/api/mastodon/helpers/search.ts index e2f2951c3..3224718b3 100644 --- a/packages/backend/src/server/api/mastodon/helpers/search.ts +++ b/packages/backend/src/server/api/mastodon/helpers/search.ts @@ -65,8 +65,8 @@ export class SearchHelpers { if (!match) match = q.match(/^@(?[a-zA-Z0-9_]+)$/) if (match) { // check if user is already in database - const dbResult = await Users.findBy({usernameLower: match.groups!.user.toLowerCase(), host: match.groups?.host ?? IsNull()}); - if (dbResult) return dbResult; + const dbResult = await Users.findOneBy({usernameLower: match.groups!.user.toLowerCase(), host: match.groups?.host ?? IsNull()}); + if (dbResult) return [dbResult]; const result = await resolveUser(match.groups!.user.toLowerCase(), match.groups?.host ?? null); if (result) return [result];