From 9e63a9dc874ce867aba39672ef99a298b08ab806 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 16 Nov 2025 08:34:15 +0000 Subject: [PATCH] completionId: cgen-7335c5c640504f1081885bb4461dc9d6 cgen-7335c5c640504f1081885bb4461dc9d6 --- client/contexts/AuthContext.tsx | 46 +++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 7bc3f469..c185c9fa 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -396,27 +396,33 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ rewardsActivatedRef.current = true; - aethexAchievementService - .activateCommunityRewards({ - email: "mrpiglr@gmail.com", - username: "mrpiglr", - }) - .then((response) => { - if (response?.godModeAwarded) { - try { - aethexToast.success({ - title: "GOD mode activated", - description: "Legendary rewards synced for mrpiglr.", - }); - } catch (toastError) { - console.warn("Failed to show activation toast", toastError); + // Only attempt to activate if this is the admin user + if (profile?.email === "mrpiglr@gmail.com" || profile?.username === "mrpiglr") { + aethexAchievementService + .activateCommunityRewards({ + email: profile?.email, + username: profile?.username, + }) + .then((response) => { + if (response?.godModeAwarded) { + try { + aethexToast.success({ + title: "GOD mode activated", + description: "Legendary rewards synced.", + }); + } catch (toastError) { + console.warn("Failed to show activation toast", toastError); + } } - } - }) - .catch((error) => { - console.warn("activateCommunityRewards invocation failed", error); - rewardsActivatedRef.current = false; - }); + }) + .catch((error) => { + console.warn( + "activateCommunityRewards invocation failed", + error?.message || error, + ); + rewardsActivatedRef.current = false; + }); + } }, [user, profile, roles]); const inviteProcessedRef = useRef(false);