Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

862: Attachment cannot be downloaded #892

Merged
merged 2 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const ApplicationVerification = ({ applicationVerificationAccessKey }: Applicati
<Typography variant='h6' mb='8px'>
Antrag vom {format(createdDate, 'dd.MM.yyyy, HH:mm')}
</Typography>
<JsonFieldView jsonField={jsonField} baseUrl={baseUrl} hierarchyIndex={0} />
<JsonFieldView jsonField={jsonField} baseUrl={baseUrl} hierarchyIndex={0} attachmentAccessible={false} />
<Divider style={{ margin: '24px 0px' }} />
<Typography mt='8px' variant='body1'>
Können Sie die Angaben, welche die Organisation <b>{data.verification.organizationName}</b> betreffen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ const ApplicationApplicantView = ({
<Typography mb='8px' variant='h6'>
Ihr Antrag auf die Ehrenamtskarte Bayern vom {format(createdDate, 'dd.MM.yyyy, HH:mm')}
</Typography>
<JsonFieldView jsonField={jsonField} baseUrl={baseUrl} key={0} hierarchyIndex={0} />
<JsonFieldView
jsonField={jsonField}
baseUrl={baseUrl}
key={0}
hierarchyIndex={0}
attachmentAccessible={false}
/>
<Divider style={{ margin: '24px 0px' }} />
<VerificationsView verifications={application.verifications} />
{!application.withdrawalDate && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const ApplicationView: FunctionComponent<{ application: Application; gotDeleted:
Bitte löschen Sie den Antrag zeitnah.
</WithdrawAlert>
)}
<JsonFieldView jsonField={jsonField} baseUrl={baseUrl} key={0} hierarchyIndex={0} />
<JsonFieldView jsonField={jsonField} baseUrl={baseUrl} key={0} hierarchyIndex={0} attachmentAccessible />
<Divider style={{ margin: '24px 0px' }} />
<VerificationsView verifications={application.verifications} />
<div
Expand Down
14 changes: 12 additions & 2 deletions administration/src/components/applications/JsonFieldView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ const ParentOfBorder = styled.div<{ $hierarchyIndex: number }>`
}
`

const JsonFieldView = (props: { jsonField: GeneralJsonField; baseUrl: string; hierarchyIndex: number }) => {
const JsonFieldView = (props: {
jsonField: GeneralJsonField
baseUrl: string
hierarchyIndex: number
attachmentAccessible: boolean
}) => {
const appToaster = useAppToaster()
const token = useContext(AuthContext).data?.token

Expand All @@ -56,6 +61,7 @@ const JsonFieldView = (props: { jsonField: GeneralJsonField; baseUrl: string; hi
baseUrl={props.baseUrl}
key={index}
hierarchyIndex={props.hierarchyIndex + 1}
attachmentAccessible={props.attachmentAccessible}
/>
))
return props.jsonField.translations.de.length === 0 ? (
Expand Down Expand Up @@ -132,7 +138,11 @@ const JsonFieldView = (props: { jsonField: GeneralJsonField; baseUrl: string; hi
return (
<p>
{props.jsonField.translations.de}:&nbsp;
<Button icon='download' onClick={onClick}>{`Anhang ${props.jsonField.value.fileIndex}`}</Button>
{props.attachmentAccessible ? (
<Button icon='download' onClick={onClick}>{`Anhang ${props.jsonField.value.fileIndex}`}</Button>
) : (
<span>eingereicht, nicht sichtbar</span>
)}
</p>
)
}
Expand Down