From 2e64df99141cd30ac97f37aaa38d4472ac21072f Mon Sep 17 00:00:00 2001 From: janicelichtman Date: Tue, 5 May 2026 17:36:42 -0400 Subject: [PATCH 1/2] fixing bug on testimony detail page so users must verify email before submitting testimony --- .../TestimonyDetailPage/PolicyActions.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/testimony/TestimonyDetailPage/PolicyActions.tsx b/components/testimony/TestimonyDetailPage/PolicyActions.tsx index 959d48777..b3636a961 100644 --- a/components/testimony/TestimonyDetailPage/PolicyActions.tsx +++ b/components/testimony/TestimonyDetailPage/PolicyActions.tsx @@ -129,7 +129,10 @@ export const PolicyActions: FC> = ({ setFollowStatus(prev => ({ ...prev, [topicName]: false })) } + const { t } = useTranslation("testimony") + const isFollowing = followStatus[topicName] + const isUnverified = !!user && !isUser && !user.emailVerified const text = isFollowing ? "Unfollow" : "Follow" const checkmark = isFollowing ? ( @@ -159,13 +162,19 @@ export const PolicyActions: FC> = ({ items.push( ) - const { t } = useTranslation("testimony") - return ( Date: Tue, 5 May 2026 20:31:04 -0400 Subject: [PATCH 2/2] added redirect from submit testimony page to profile page for users that are not email verified --- pages/submit-testimony.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pages/submit-testimony.tsx b/pages/submit-testimony.tsx index 618c2391a..581900004 100644 --- a/pages/submit-testimony.tsx +++ b/pages/submit-testimony.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react" import { useRouter } from "next/router" -import { requireAuth } from "../components/auth" +import { requireAuth, useAuth } from "../components/auth" import { isActiveBallotQuestionPhase } from "../components/ballotquestions/status" import { dbService } from "../components/db" import { createPage } from "../components/page" @@ -18,11 +18,17 @@ export default createPage({ function SubmitTestimonyPage() { const router = useRouter() + const { user } = useAuth() const [isAllowed, setIsAllowed] = useState(false) useEffect(() => { if (!router.isReady) return + if (user && !user.emailVerified) { + void router.replace(`/profile?id=${user.uid}`) + return + } + const ballotQuestionId = typeof router.query.ballotQuestionId === "string" ? router.query.ballotQuestionId @@ -62,7 +68,7 @@ function SubmitTestimonyPage() { return () => { active = false } - }, [router]) + }, [router, user]) if (!isAllowed) return null