Fix /suspended 500 when banned user row was deleted via migrate
Some checks are pending
E2E Tests / e2e (push) Waiting to run
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

This commit is contained in:
Kalle
2026-05-03 14:47:20 +03:00
parent 767ca4d7ab
commit b5f8b3667d
2 changed files with 9 additions and 2 deletions

View File

@@ -39,6 +39,8 @@ export const action = async ({ request }: ActionFunctionArgs) => {
errorToast(`Migration failed. Reason: ${errorMessage}`);
}
await refreshBannedCache();
message = "Account migrated";
break;
} catch (err) {

View File

@@ -6,14 +6,19 @@ import {
} from "~/features/auth/core/authenticator.server";
import { authSessionStorage } from "~/features/auth/core/session.server";
import type { Nullish } from "~/utils/types";
import { userIsBanned } from "../core/banned.server";
import { refreshBannedCache, userIsBanned } from "../core/banned.server";
export const loader = async ({ request }: LoaderFunctionArgs) => {
const userId = await getUserIdEvenIfBanned(request);
if (!userId || !userIsBanned(userId)) return redirect("/");
const bannedStatus = (await AdminRepository.allBannedUsers()).get(userId)!;
const bannedStatus = (await AdminRepository.allBannedUsers()).get(userId);
if (!bannedStatus) {
await refreshBannedCache();
return redirect("/");
}
return {
banned: bannedStatus.banned,