Skip to content

Commit

Permalink
Merge branch 'main' into j-s/withdraw-case
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 23, 2024
2 parents fdda7fb + a84ba44 commit 8735126
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 26 deletions.
10 changes: 9 additions & 1 deletion libs/api/domains/documents/src/lib/documentV2.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ export class DocumentServiceV2 {
const actions = document.actions?.filter(
(action) => action.type !== 'alert' && action.type !== 'confirmation',
)
if (document.urgent)
this.logger.info('Urgent document fetched', {
documentId: documentId,
includeDocument,
})

return {
...document,
publicationDate: document.date,
Expand Down Expand Up @@ -484,7 +490,7 @@ export class DocumentServiceV2 {

// we return the document even if the actions are faulty, logged for tracability
if (hasEmpty) {
this.logger.warn('No title or data in actions array', {
this.logger.info('No title or data in actions array, return undefined', {
category: LOG_CATEGORY,
id,
})
Expand All @@ -511,6 +517,8 @@ export class DocumentServiceV2 {
}
})

// Log the actions to ensure that they are mapped correctly
this.logger.info('Actions mapped successfully', { actions: mapped })
return mapped
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ export class LawAndOrderResolver {
@Args('locale', { type: () => String, nullable: true })
locale: Locale = 'is',
) {
return this.lawAndOrderService.getLawyers(user, locale)
return this.auditAndHandle(
'getLawyers',
'lawyers',
this.lawAndOrderService.getLawyers(user, locale),
user,
)
}

@Mutation(() => DefenseChoice, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { m } from '../../../lib/messages'
import { PermissionFormTypes } from '../EditPermission.schema'
import { useEnvironmentState } from '../../../hooks/useEnvironmentState'
import { checkEnvironmentsSync } from '../../../utils/checkEnvironmentsSync'
import { useSuperAdmin } from '../../../hooks/useSuperAdmin'

const commonProps: Pick<CheckboxProps, 'backgroundColor' | 'large' | 'value'> =
{
Expand All @@ -20,6 +21,7 @@ const commonProps: Pick<CheckboxProps, 'backgroundColor' | 'large' | 'value'> =
export const PermissionAccessControl = () => {
const { formatMessage } = useLocale()
const { selectedPermission, permission } = usePermission()
const { isSuperAdmin } = useSuperAdmin()
const { isAccessControlled, grantToAuthenticatedUser } = selectedPermission

const [inputValues, setInputValues] = useEnvironmentState<{
Expand All @@ -40,19 +42,21 @@ export const PermissionAccessControl = () => {
])}
>
<Stack space={3}>
<Checkbox
label={formatMessage(m.isAccessControlled)}
subLabel={formatMessage(m.isAccessControlledDescription)}
name="isAccessControlled"
checked={inputValues.isAccessControlled}
onChange={(e) => {
setInputValues({
...inputValues,
isAccessControlled: e.target.checked,
})
}}
{...commonProps}
/>
{isSuperAdmin && (
<Checkbox
label={formatMessage(m.isAccessControlled)}
subLabel={formatMessage(m.isAccessControlledDescription)}
name="isAccessControlled"
checked={inputValues.isAccessControlled}
onChange={(e) => {
setInputValues({
...inputValues,
isAccessControlled: e.target.checked,
})
}}
{...commonProps}
/>
)}
<Checkbox
label={formatMessage(m.grantToAuthenticatedUser)}
subLabel={formatMessage(m.grantToAuthenticatedUserDescription)}
Expand Down
10 changes: 10 additions & 0 deletions libs/portals/admin/signature-collection/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ export const m = defineMessages({
defaultMessage: 'Úrvinnslu lokið',
description: '',
},
toggleReviewSuccessToggleBack: {
id: 'admin-portal.signature-collection:toggleReviewSuccessToggleBack',
defaultMessage: 'Tókst að opna fyrir úrvinnslu',
description: '',
},
lockList: {
id: 'admin-portal.signature-collection:lockList',
defaultMessage: 'Læsa söfnun',
Expand Down Expand Up @@ -754,6 +759,11 @@ export const m = defineMessages({
defaultMessage: 'Ekki tókst að skrá meðmæli',
description: '',
},
paperSigneeErrorAlreadySigned: {
id: 'admin-portal.signature-collection:paperSigneeErrorAlreadySigned',
defaultMessage: 'Kennitala er þegar á lista',
description: '',
},
})

export const createCollectionErrorMessages = defineMessages({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,10 @@ export const Constituency = ({
': ' +
constituencyLists.length}
</Text>
{allowedToProcess &&
collectionStatus === CollectionStatus.InInitialReview && (
<CreateCollection
collectionId={collection?.id}
areaId={areaId}
/>
)}
<CreateCollection
collectionId={collection?.id}
areaId={areaId}
/>
</Box>
<Stack space={3}>
{constituencyLists.map((list) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ export const PaperSignees = ({ listId }: { listId: string }) => {
if (res.signatureCollectionAdminUploadPaperSignature?.success) {
toast.success(formatMessage(m.paperSigneeSuccess))
} else {
toast.error(formatMessage(m.paperSigneeError))
if (
res.signatureCollectionAdminUploadPaperSignature?.reasons?.includes(
'alreadySigned',
)
) {
toast.error(formatMessage(m.paperSigneeErrorAlreadySigned))
}
}
reset()
revalidate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ const ActionReviewComplete = ({
onCompleted: () => {
setModalSubmitReviewIsOpen(false)
revalidate()
toast.success(formatMessage(m.toggleReviewSuccess))
toast.success(
listReviewed
? formatMessage(m.toggleReviewSuccessToggleBack)
: formatMessage(m.toggleReviewSuccess),
)
},
onError: () => {
toast.error(formatMessage(m.toggleReviewError))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const DefenderChoices: FC<React.PropsWithChildren<Props>> = ({
</>
))}

{!popUp && (
{!popUp && !error && (
<Button
type="submit"
size="small"
Expand All @@ -201,7 +201,7 @@ const DefenderChoices: FC<React.PropsWithChildren<Props>> = ({
)}
</Button>
)}
{popUp && (
{popUp && !error && (
<Box
display="flex"
flexDirection="row"
Expand Down

0 comments on commit 8735126

Please sign in to comment.