From 2bbc6d7c05d4800e7196afbd425ae08089897fda Mon Sep 17 00:00:00 2001
From: Yael Monterrubio <142482823+Y4ELX@users.noreply.github.com>
Date: Sun, 19 Apr 2026 14:43:17 -0600
Subject: [PATCH] fix: refactor user role checks in ProfileLayout
---
frontend/src/pages/profile/layout.tsx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/frontend/src/pages/profile/layout.tsx b/frontend/src/pages/profile/layout.tsx
index 5a16395..23265eb 100644
--- a/frontend/src/pages/profile/layout.tsx
+++ b/frontend/src/pages/profile/layout.tsx
@@ -42,11 +42,11 @@ export default function ProfileLayout() {
return
Loading...
;
}
- const currentUser = user ?? $session?.user;
+ const sessionUserId = $session?.user?.id ? Number($session.user.id) : null;
const page = location.pathname;
- const isAdmin = currentUser?.id === Number(import.meta.env.VITE_ADMIN_USER_ID);
- const isContributor = import.meta.env.VITE_CONTRIBUTORS_USER_IDS?.split(",").includes(user?.id);
- const isOwnProfile = currentUser?.id === user?.id;
+ const isAdmin = sessionUserId === Number(import.meta.env.VITE_ADMIN_USER_ID);
+ const isContributor = import.meta.env.VITE_CONTRIBUTORS_USER_IDS?.split(",").includes(String(user?.id));
+ const isOwnProfile = sessionUserId === user?.id;
return (