From 47946f10404deea9f02db8d142a70985b6cfc0d5 Mon Sep 17 00:00:00 2001 From: saschabuehrle Date: Fri, 13 Mar 2026 08:14:29 +0100 Subject: [PATCH 1/2] fix: redirect logged-out users to login when following a bill (fixes #2059) --- components/shared/FollowButton.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/shared/FollowButton.tsx b/components/shared/FollowButton.tsx index 87fa5ec81..505397217 100644 --- a/components/shared/FollowButton.tsx +++ b/components/shared/FollowButton.tsx @@ -1,5 +1,6 @@ import { StyledImage } from "components/ProfilePage/StyledProfileComponents" import { useTranslation } from "next-i18next" +import { useRouter } from "next/router" import { useEffect, useContext } from "react" import { Button } from "react-bootstrap" import { useAuth } from "../auth" @@ -19,6 +20,7 @@ export const BaseFollowButton = ({ hide?: boolean }) => { const { t } = useTranslation(["profile"]) + const router = useRouter() const { user } = useAuth() const uid = user?.uid @@ -50,8 +52,14 @@ export const BaseFollowButton = ({ const checkmark = isFollowing ? ( ) : null - const handleClick = (event: React.FormEvent) => { + const handleClick = (event: React.MouseEvent) => { event.preventDefault() + + if (!uid) { + router.push(`/login?redirect=${encodeURIComponent(router.asPath)}`) + return + } + isFollowing ? UnfollowClick() : FollowClick() } From ff6daa0f3f1eeccb632323a189cf396152a1c7a1 Mon Sep 17 00:00:00 2001 From: saschabuehrle Date: Wed, 1 Apr 2026 15:36:33 +0200 Subject: [PATCH 2/2] fix: redirect logged-out follow action in testimony detail --- .../testimony/TestimonyDetailPage/PolicyActions.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/testimony/TestimonyDetailPage/PolicyActions.tsx b/components/testimony/TestimonyDetailPage/PolicyActions.tsx index 90d8c4d52..23a85b609 100644 --- a/components/testimony/TestimonyDetailPage/PolicyActions.tsx +++ b/components/testimony/TestimonyDetailPage/PolicyActions.tsx @@ -5,6 +5,7 @@ import { formUrl } from "components/publish" import { FC, ReactElement, useContext, useEffect } from "react" import { useCurrentTestimonyDetails } from "./testimonyDetailSlice" import { useTranslation } from "next-i18next" +import { useRouter } from "next/router" import { useAuth } from "components/auth" import { TopicQuery } from "components/shared/FollowingQueries" import { StyledImage } from "components/ProfilePage/StyledProfileComponents" @@ -39,6 +40,7 @@ export const PolicyActions: FC> = ({ const { user } = useAuth() const uid = user?.uid + const router = useRouter() const { followStatus, setFollowStatus } = useContext(FollowContext) @@ -69,6 +71,12 @@ export const PolicyActions: FC> = ({ ) : null const handleClick = (event: React.MouseEvent) => { event.preventDefault() + + if (!uid) { + router.push(`/login?redirect=${encodeURIComponent(router.asPath)}`) + return + } + isFollowing ? UnfollowClick() : FollowClick() }