[mastodon-client] Fix resolving remote users that aren't yet in the database

This commit is contained in:
Laura Hausmann 2023-10-01 13:58:12 +02:00
parent 947f5ba1e2
commit ae91ffbb8a
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -65,8 +65,8 @@ export class SearchHelpers {
if (!match) match = q.match(/^@(?<user>[a-zA-Z0-9_]+)$/) if (!match) match = q.match(/^@(?<user>[a-zA-Z0-9_]+)$/)
if (match) { if (match) {
// check if user is already in database // check if user is already in database
const dbResult = await Users.findBy({usernameLower: match.groups!.user.toLowerCase(), host: match.groups?.host ?? IsNull()}); const dbResult = await Users.findOneBy({usernameLower: match.groups!.user.toLowerCase(), host: match.groups?.host ?? IsNull()});
if (dbResult) return dbResult; if (dbResult) return [dbResult];
const result = await resolveUser(match.groups!.user.toLowerCase(), match.groups?.host ?? null); const result = await resolveUser(match.groups!.user.toLowerCase(), match.groups?.host ?? null);
if (result) return [result]; if (result) return [result];