Skip to content

Commit

Permalink
Merge branch 'main' into release-please--branches--main--components--…
Browse files Browse the repository at this point in the history
…benefit-applicant
  • Loading branch information
mjturt authored Aug 29, 2023
2 parents df3cb6a + c86d24c commit 64bb3e1
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bf-applicant-frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ jobs:
- name: Check that building dev application works
env:
NEXTJS_DISABLE_SENTRY: true
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
run: yarn build
2 changes: 1 addition & 1 deletion .github/workflows/bf-handler-frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ jobs:
- name: Check that building dev application works
env:
NEXTJS_DISABLE_SENTRY: true
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
run: yarn build
2 changes: 1 addition & 1 deletion .github/workflows/ks-empl-frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Check that building dev application works
env:
NEXTJS_DISABLE_SENTRY: true
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
run: yarn build
- name: Frontend build failure slack notification
uses: rtCamp/action-slack-notify@v2
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ks-handler-frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Check that building dev application works
env:
NEXTJS_DISABLE_SENTRY: true
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
run: yarn build
- name: Frontend build failure slack notification
uses: rtCamp/action-slack-notify@v2
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ks-youth-frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Check that building dev application works
env:
NEXTJS_DISABLE_SENTRY: true
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
run: yarn build
- name: Frontend build failure slack notification
uses: rtCamp/action-slack-notify@v2
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/te-admn-frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Check that building dev application works
env:
NEXTJS_DISABLE_SENTRY: true
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
run: yarn build
- name: Frontend build failure slack notification
uses: rtCamp/action-slack-notify@v2
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/te-yout-frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Check that building dev application works
env:
NEXTJS_DISABLE_SENTRY: true
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
run: yarn build
- name: Frontend build failure slack notification
uses: rtCamp/action-slack-notify@v2
env:
Expand Down
4 changes: 2 additions & 2 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"backend/benefit": "1.0.0",
"backend/benefit": "1.1.0",
"backend/kesaseteli": "1.2.0",
"backend/tet": "1.0.0",
"frontend/benefit/applicant": "2.0.0",
"frontend/benefit/handler": "1.0.0",
"frontend/benefit/handler": "1.1.0",
"frontend/kesaseteli/employer": "1.1.0",
"frontend/kesaseteli/handler": "1.0.0",
"frontend/kesaseteli/youth": "1.0.0",
Expand Down
36 changes: 36 additions & 0 deletions backend/benefit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog

## [1.1.0](https://github.com/City-of-Helsinki/yjdh/compare/benefit-backend-v1.0.0...benefit-backend-v1.1.0) (2023-08-28)


### Features

* Add fields to Talpa/P2P inspectors ([f574281](https://github.com/City-of-Helsinki/yjdh/commit/f574281e37f71470bdda3ac3c7fb28311b3f2ca5))
* Add new P2P fields to Talpa CSV ([d8c2c3f](https://github.com/City-of-Helsinki/yjdh/commit/d8c2c3fb640351483e697b3c4535abbb141166a7))
* Batch P2P fields are validated based on proposal for decision ([90c87cb](https://github.com/City-of-Helsinki/yjdh/commit/90c87cb240372ce6e5746aceaa90e48e98ce4985))
* Expose is_staff attribute for user API ([30b3501](https://github.com/City-of-Helsinki/yjdh/commit/30b350116e48e383e479e56d1ece5b1150218018))
* Expose new p2p fields to batch listing ([a421590](https://github.com/City-of-Helsinki/yjdh/commit/a421590cf8ef9ee5c13b5bb7487d5031bca919cc))
* Expose previous status state to frontend ([e2a27ab](https://github.com/City-of-Helsinki/yjdh/commit/e2a27abfef76fe268267e2e4219fa5234efe3ddb))
* **ks-employer-frontend:** Autofill employee data ([f1258f6](https://github.com/City-of-Helsinki/yjdh/commit/f1258f6889ac6dd97fe5e3c621795dbfa2b3a0d8))
* Rework batch handling so that accepted batches have an additional archival step ([d9ccd0c](https://github.com/City-of-Helsinki/yjdh/commit/d9ccd0c89337ddaf70cadb195e2742e8343011b1))
* Send language to backend on language selection ([f94eb18](https://github.com/City-of-Helsinki/yjdh/commit/f94eb1807d8ed0a271c1aba5901a0ec7292ff413))
* Test simplified_application_list's filter_archived option ([8ab6113](https://github.com/City-of-Helsinki/yjdh/commit/8ab6113336a790cdae6c927089b23ffae7d61294))
* Test too many draft batches and removal if emptied from apps ([3c6047e](https://github.com/City-of-Helsinki/yjdh/commit/3c6047e0c222202689326ec35ccbd16964c39338))


### Bug Fixes

* Allow sent_to_talpa status on batch status change ([06829f3](https://github.com/City-of-Helsinki/yjdh/commit/06829f350dfd8b719dc128c73c313f0a70d8daa7))
* Allow two decimals for working hours ([15eee56](https://github.com/City-of-Helsinki/yjdh/commit/15eee56c11d7f310cbebeb5b035641a82d10cb5e))
* Allow use of django_language cookie ([7f57cbf](https://github.com/City-of-Helsinki/yjdh/commit/7f57cbffb266053190bec35edbfa8a87c49d484a))
* Batch handler name's was missing; fix closing tag ([85b3a01](https://github.com/City-of-Helsinki/yjdh/commit/85b3a018252eef38991542fc6be004af9d50c9ec))
* Batch test failed because of new allowed status ([a59a38a](https://github.com/City-of-Helsinki/yjdh/commit/a59a38aa0bbc46a63ecb7c2dc7f74c7e710f4229))
* Batch would allow no values on p2p/ahjo fields ([99e469d](https://github.com/City-of-Helsinki/yjdh/commit/99e469d167454a1980068ad3291311247f82b7d7))
* Broken csv test because of new talpa fields ([90554bb](https://github.com/City-of-Helsinki/yjdh/commit/90554bb5f9c120dc70c8058a4bdbe769b3eaec91))
* CSV should not contain quotes ([e26ebb4](https://github.com/City-of-Helsinki/yjdh/commit/e26ebb4f610feb1f95f49e91f6542312ed28bab4))
* Get the pruned version of Talpa csv from endpoint ([b49f86b](https://github.com/City-of-Helsinki/yjdh/commit/b49f86bb7957fd5824a564b6ef4a2357238b7f1c))
* Lint backend files ([19e3470](https://github.com/City-of-Helsinki/yjdh/commit/19e347083c468d39eb8ec409491f47e67e4a05d6))
* Model tests were failing ([89754ff](https://github.com/City-of-Helsinki/yjdh/commit/89754ff08273f9fe7c685ac2b645eac06ad33f62))
* Removing app from batch would result to whole batch close animation ([be1fff8](https://github.com/City-of-Helsinki/yjdh/commit/be1fff85d6b140b681f5f13fa2d16a5b8db2066d))
* Rename conflicting migration file ([1ccd538](https://github.com/City-of-Helsinki/yjdh/commit/1ccd538e986459316d328123ed484d9147162228))
* Rename Talpa CSV headers ([14162d4](https://github.com/City-of-Helsinki/yjdh/commit/14162d46a73a62b822e3d27ef27c3a5e2a5876e0))
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,10 @@ def _validate_employee_consent(self, instance):

def _update_applicant_terms_approval(self, instance, approve_terms):
if ApplicantTermsApproval.terms_approval_needed(instance):
# Ignore applicant's terms if app origin is from handler
if instance.application_origin == ApplicationOrigin.HANDLER:
return

if not approve_terms:
raise serializers.ValidationError(
{"approve_terms": _("Terms must be approved")}
Expand Down
43 changes: 42 additions & 1 deletion backend/benefit/applications/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,51 @@ class Meta:
model = Application


attachment_factory_string = "applications.tests.factories.AttachmentFactory"


class ApplicationWithAttachmentFactory(ApplicationFactory):
attachment = factory.RelatedFactory(
"applications.tests.factories.AttachmentFactory",
attachment_factory_string,
factory_related_name="application",
attachment_type="employment_contract",
)
attachment_2 = factory.RelatedFactory(
attachment_factory_string,
factory_related_name="application",
attachment_type="pay_subsidy_decision",
)

attachment_3 = factory.RelatedFactory(
attachment_factory_string,
factory_related_name="application",
attachment_type="commission_contract",
)

attachment_4 = factory.RelatedFactory(
attachment_factory_string,
factory_related_name="application",
attachment_type="education_contract",
)
attachment_5 = factory.RelatedFactory(
attachment_factory_string,
factory_related_name="application",
attachment_type="helsinki_benefit_voucher",
)
attachment_6 = factory.RelatedFactory(
attachment_factory_string,
factory_related_name="application",
attachment_type="employee_consent",
)
attachment_7 = factory.RelatedFactory(
attachment_factory_string,
factory_related_name="application",
attachment_type="full_application",
)
attachment_8 = factory.RelatedFactory(
attachment_factory_string,
factory_related_name="application",
attachment_type="other_attachment",
)


Expand Down
6 changes: 2 additions & 4 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ FROM appbase as development

# Set V8 max heap size to 2GB (default is 512MB)
# This prevents Docker Compose from crashing due to out of memory errors
ENV NODE_OPTIONS="--max_old_space_size=2048 --openssl-legacy-provider"
ENV NODE_OPTIONS="--max_old_space_size=2048"

ARG PROJECT
ARG FOLDER
Expand Down Expand Up @@ -92,7 +92,7 @@ COPY --chown=appuser:appuser . .
# Build application
WORKDIR /app/$PROJECT/$FOLDER/

RUN NODE_OPTIONS=--openssl-legacy-provider yarn build
RUN yarn build

# Clean all dependencies (this should avoid caching + missing /pages directory problem)
RUN rm -rf node_modules
Expand All @@ -102,8 +102,6 @@ RUN yarn cache clean
FROM helsinkitest/node:18-slim AS production
# ==========================================

ENV NODE_OPTIONS="--openssl-legacy-provider"

ARG PORT
ARG PROJECT
ARG FOLDER
Expand Down
37 changes: 37 additions & 0 deletions frontend/benefit/handler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

## [1.1.0](https://github.com/City-of-Helsinki/yjdh/compare/benefit-handler-v1.0.0...benefit-handler-v1.1.0) (2023-08-28)


### Features

* Display appropriate error message when adding apps to batch but it's already locked ([dad590c](https://github.com/City-of-Helsinki/yjdh/commit/dad590c89c2ba78048e741f240c1c81a4c5517b4))
* Hide handler and applicant from search engines ([510a1cd](https://github.com/City-of-Helsinki/yjdh/commit/510a1cdd7678ed3be4ca14ead2ae182eabf2bf24))
* **ks-employer-frontend:** Autofill employee data ([f1258f6](https://github.com/City-of-Helsinki/yjdh/commit/f1258f6889ac6dd97fe5e3c621795dbfa2b3a0d8))
* P2p/ahjo inspection inputs are shown based on radio selection ([d85001b](https://github.com/City-of-Helsinki/yjdh/commit/d85001bced1aac0232356c8b7e21c2dbea39da61))
* Refactor and add confirmation to all batch status changes ([d4a70bd](https://github.com/City-of-Helsinki/yjdh/commit/d4a70bd7b96449d65ecd7aa65e976e00c0de866f))
* Refetch batches after every 60 seconds ([200d2fe](https://github.com/City-of-Helsinki/yjdh/commit/200d2fec79315872e3b82a30a18524884f60794d))
* Rework batch handling so that accepted batches have an additional archival step ([d9ccd0c](https://github.com/City-of-Helsinki/yjdh/commit/d9ccd0c89337ddaf70cadb195e2742e8343011b1))
* Some small visual changes to archive page ([9cb38b1](https://github.com/City-of-Helsinki/yjdh/commit/9cb38b17ff37e25ddac7c5f64c18a64c78e4375b))
* Transition batch with close animation when status changes ([59aa19f](https://github.com/City-of-Helsinki/yjdh/commit/59aa19f5a1710e002ceb3eafce33aefe1d2a92a1))
* Trash batch, use tooltip and toggle button to remove batch from being locked ([89d320d](https://github.com/City-of-Helsinki/yjdh/commit/89d320d17325256d85971b149fb115c6c420e59c))
* Use openDrawer param on application page to open sidebar ([ff747ae](https://github.com/City-of-Helsinki/yjdh/commit/ff747ae1cd6ace72ccd769907c2b3c78e8af88d7))
* Use P2P fields in batch form ([307120e](https://github.com/City-of-Helsinki/yjdh/commit/307120e9e18b61c0b047d889adbbf237f3e55c95))
* Use sms style layout for chats in applicant and handler ([c0ba913](https://github.com/City-of-Helsinki/yjdh/commit/c0ba913db40cea2d59235b819a8ce07a418ea5b9))
* Users without permissions will be logged out ([4a84f92](https://github.com/City-of-Helsinki/yjdh/commit/4a84f92ed1c20870094ebd288a1f6f59d0db1caa))


### Bug Fixes

* Add missing messenger translations ([59d253f](https://github.com/City-of-Helsinki/yjdh/commit/59d253fc0406b3d11d8f9a826ff6e20939b96502))
* Add more mime types as allowed uploads ([87a9c66](https://github.com/City-of-Helsinki/yjdh/commit/87a9c669fd2753680ccfe20a97e097a82c4eb59e))
* Allow two decimals for working hours ([15eee56](https://github.com/City-of-Helsinki/yjdh/commit/15eee56c11d7f310cbebeb5b035641a82d10cb5e))
* Batch handler name's was missing; fix closing tag ([85b3a01](https://github.com/City-of-Helsinki/yjdh/commit/85b3a018252eef38991542fc6be004af9d50c9ec))
* Change odd text when adding apps to batch ([e172139](https://github.com/City-of-Helsinki/yjdh/commit/e172139664152fa5737631ffe37a7508486a69b9))
* Confusing text when application is accepted or rejected ([6dd2599](https://github.com/City-of-Helsinki/yjdh/commit/6dd259941176ee47d8bc2ddb779c2f823218f778))
* Decided and rejected batch should be archived ([ccc0cfc](https://github.com/City-of-Helsinki/yjdh/commit/ccc0cfc4167304a54009ec32ede3a0814490bb3d))
* Hide certain actions when app is archived or in a batch ([5cfb28c](https://github.com/City-of-Helsinki/yjdh/commit/5cfb28c01cc32d690dd42d6b9eaccd919be9a9ff))
* Lint issues ([2131591](https://github.com/City-of-Helsinki/yjdh/commit/2131591324d492aef735a542a690284d21e34e78))
* Removing app from batch would result to whole batch close animation ([be1fff8](https://github.com/City-of-Helsinki/yjdh/commit/be1fff85d6b140b681f5f13fa2d16a5b8db2066d))
* Some favicons had wrong asset path ([4eae5a3](https://github.com/City-of-Helsinki/yjdh/commit/4eae5a3dd0fa507d6e7c25404c15b2d9014f6882))
* Tables would sort dates based on alphabetical order ([f87056c](https://github.com/City-of-Helsinki/yjdh/commit/f87056c5336439e0434d1b02474f4e1e48d59904))
2 changes: 1 addition & 1 deletion frontend/benefit/handler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@frontend/bf-handler",
"version": "1.0.0",
"version": "1.1.0",
"license": "MIT",
"scripts": {
"dev": "PORT=3100 node ../../shared/src/server/next-server.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { ROUTES } from 'benefit/handler/constants';
import { UploadProps } from 'benefit/handler/types/application';
import { ATTACHMENT_TYPES } from 'benefit-shared/constants';
import { Button, IconGlyphEuro, IconPlus } from 'hds-react';
import noop from 'lodash/noop';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
import * as React from 'react';
import UploadAttachment from 'shared/components/attachments/UploadAttachment';
import { $Checkbox } from 'shared/components/forms/fields/Fields.sc';
import {
$Grid,
$GridCell,
Expand Down Expand Up @@ -76,27 +74,6 @@ const EmployeeActions: React.FC<UploadProps> = ({
</Button>
</$GridCell>
</$Grid>
<$Grid>
<$GridCell
$colSpan={2}
css={`
margin-bottom: ${theme.spacing.s};
`}
>
<$Checkbox
css={`
input {
background-color: ${theme.colors.white};
}
`}
id="cb_targetGroupCheck"
name="cb_targetGroupCheck"
label={t(`${translationsBase}.targetGroupCheck`)}
checked={false}
onChange={noop}
/>
</$GridCell>
</$Grid>
</$ActionsWrapper>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { UploadProps } from 'benefit/handler/types/application';
import { ATTACHMENT_TYPES } from 'benefit-shared/constants';
import { IconPlus } from 'hds-react';
import noop from 'lodash/noop';
import { useTranslation } from 'next-i18next';
import * as React from 'react';
import UploadAttachment from 'shared/components/attachments/UploadAttachment';
import { $Checkbox } from 'shared/components/forms/fields/Fields.sc';
import {
$Grid,
$GridCell,
Expand Down Expand Up @@ -56,27 +54,6 @@ const PaySubsidyActions: React.FC<UploadProps> = ({
/>
</$GridCell>
</$Grid>
<$Grid>
<$GridCell
$colSpan={12}
css={`
margin-bottom: ${theme.spacing.s};
`}
>
<$Checkbox
css={`
input {
background-color: ${theme.colors.white};
}
`}
id="cb_grantedDueInjury"
name="cb_grantedDueInjury"
label={t(`${translationsBase}.grantedDueInjury`)}
checked={false}
onChange={noop}
/>
</$GridCell>
</$Grid>
</$ActionsWrapper>
);
};
Expand Down
15 changes: 15 additions & 0 deletions frontend/benefit/handler/src/hooks/useUpdateApplicationQuery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { AxiosError } from 'axios';
import { BackendEndpoint } from 'benefit-shared/backend-api/backend-api';
import { ApplicationData } from 'benefit-shared/types/application';
import { useTranslation } from 'next-i18next';
import { useMutation, UseMutationResult, useQueryClient } from 'react-query';
import showErrorToast from 'shared/components/toast/show-error-toast';
import useBackendAPI from 'shared/hooks/useBackendAPI';

import { ErrorData } from '../types/common';
Expand All @@ -12,7 +14,9 @@ const useUpdateApplicationQuery = (): UseMutationResult<
ApplicationData
> => {
const { axios, handleResponse } = useBackendAPI();
const { t } = useTranslation();
const queryClient = useQueryClient();

return useMutation<ApplicationData, AxiosError<ErrorData>, ApplicationData>(
'updateApplication',
(application: ApplicationData) =>
Expand All @@ -27,6 +31,17 @@ const useUpdateApplicationQuery = (): UseMutationResult<
void queryClient.invalidateQueries('applications');
void queryClient.invalidateQueries('application');
},
onError: (error: AxiosError) => {
const errorStatus = error.response?.data
? Object.values(error.response.data)
: error.code;
showErrorToast(
t('common:applications.list.errors.fetch.label'),
t('common:applications.list.errors.fetch.text', {
status: errorStatus,
})
);
},
}
);
};
Expand Down
Loading

0 comments on commit 64bb3e1

Please sign in to comment.