server: fix user deletes being stuck in queue
ci/woodpecker/push/lint-sw Pipeline failed Details
ci/woodpecker/push/lint-backend Pipeline failed Details
ci/woodpecker/push/lint-foundkey-js Pipeline was successful Details
ci/woodpecker/push/lint-client Pipeline failed Details
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/push/test Pipeline failed Details

The user was already deleted from the user cache, so requesting the
user returned null. Because the key was not null, there was a non-null
return, in turn making further code think, fetching the user was
successful.
This commit is contained in:
Johann150 2024-03-19 18:07:41 +01:00
parent 4b121e7615
commit 5636534d03
Signed by: Johann150
GPG Key ID: 9EE6577A2A06F8F1
1 changed files with 3 additions and 4 deletions

View File

@ -35,10 +35,9 @@ export async function authUserFromKeyId(keyId: string): Promise<AuthUser | null>
return await publicKeyCache.fetch(keyId)
.then(async key => {
if (!key) return null;
else return {
user: await userByIdCache.fetch(key.userId),
key,
};
const user = await userByIdCache.fetch(key.userId);
if (!user) return null;
return { user, key };
});
}