fix(report): available only to logged in users #194

Merged
enes merged 1 commits from issues/179-only-logged-in-report into staging 2025-01-15 18:33:25 +00:00
3 changed files with 59 additions and 50 deletions

View File

@ -35,6 +35,7 @@ export const BlogPage = () => {
const isAdmin =
userState.user?.npub &&
userState.user.npub === import.meta.env.VITE_REPORTING_NPUB
const isLoggedIn = userState.auth && userState.user?.pubkey !== 'undefined'
const navigation = useNavigation()
const [commentCount, setCommentCount] = useState(0)
@ -172,6 +173,7 @@ export const BlogPage = () => {
Share
</a>
{isLoggedIn && (
<a
className='dropdown-item dropdownMainMenuItem'
id='reportPost'
@ -189,6 +191,7 @@ export const BlogPage = () => {
</svg>
Report
</a>
)}
<a
className='dropdown-item dropdownMainMenuItem'

View File

@ -194,6 +194,7 @@ const Game = () => {
const { mod, isAddedToNSFW, isBlocked, isRepost } =
useLoaderData() as ModPageLoaderResult
const userState = useAppSelector((state) => state.user)
const isLoggedIn = userState.auth && userState.user?.pubkey !== 'undefined'
const [showReportPopUp, setShowReportPopUp] = useState<number | undefined>()
useBodyScrollDisable(!!showReportPopUp)
@ -336,6 +337,7 @@ const Game = () => {
</svg>
Share
</a>
{isLoggedIn && (
<a
className='dropdown-item dropdownMainMenuItem'
id='reportPost'
@ -355,6 +357,7 @@ const Game = () => {
</svg>
Report
</a>
)}
<a
className='dropdown-item dropdownMainMenuItem'
onClick={handleBlock}

View File

@ -59,6 +59,7 @@ export const ProfilePage = () => {
const displayName =
profile?.displayName || profile?.name || '[name not set up]'
const [showReportPopUp, setShowReportPopUp] = useState(false)
const isLoggedIn = userState.auth && userState.user?.pubkey !== 'undefined'
const isOwnProfile =
userState.auth &&
userState.user?.pubkey &&
@ -376,6 +377,7 @@ export const ProfilePage = () => {
</a>
{!isOwnProfile && (
<>
{isLoggedIn && (
<a
className='dropdown-item dropdownMainMenuItem'
id='reportUser'
@ -393,6 +395,7 @@ export const ProfilePage = () => {
</svg>
Report
</a>
)}
<a
className='dropdown-item dropdownMainMenuItem'
onClick={isBlocked ? handleUnblock : handleBlock}