Skip to content

Commit

Permalink
fix: do not offer file upload when logged out (#17696)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Oct 1, 2023
1 parent 672cfd9 commit 914b8ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/lib/components/Support/SupportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { LemonFileInput } from 'lib/lemon-ui/LemonFileInput/LemonFileInput'
import { useRef } from 'react'
import { LemonInput, lemonToast } from '@posthog/lemon-ui'
import { useUploadFiles } from 'lib/hooks/useUploadFiles'
import { userLogic } from 'scenes/userLogic'

const SUPPORT_TICKET_OPTIONS: LemonSelectOptions<SupportTicketKind> = [
{
Expand Down Expand Up @@ -45,6 +46,8 @@ export function SupportModal({ loggedIn = true }: { loggedIn?: boolean }): JSX.E
const { sendSupportRequest, isSupportFormOpen, sendSupportLoggedOutRequest } = useValues(supportLogic)
const { setSendSupportRequestValue, closeSupportForm } = useActions(supportLogic)
const { objectStorageAvailable } = useValues(preflightLogic)
// the support model can be shown when logged out, file upload is not offered to anonymous users
const { user } = useValues(userLogic)

if (!preflightLogic.values.preflight?.cloud) {
if (isSupportFormOpen) {
Expand Down Expand Up @@ -124,7 +127,7 @@ export function SupportModal({ loggedIn = true }: { loggedIn?: boolean }): JSX.E
data-attr="support-form-content-input"
{...props}
/>
{objectStorageAvailable && (
{objectStorageAvailable && !!user && (
<LemonFileInput
accept="image/*"
multiple={false}
Expand Down

0 comments on commit 914b8ef

Please sign in to comment.