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

Digital post #402

Merged
merged 12 commits into from
Oct 10, 2024
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
6 changes: 2 additions & 4 deletions .docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
worker_processes auto;

error_log /var/log/nginx/error.log notice;
error_log /dev/stderr notice;
pid /tmp/nginx.pid;

events {
Expand All @@ -26,11 +26,9 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
access_log /dev/stdout main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

gzip on;
Expand Down
17 changes: 11 additions & 6 deletions .docker/vhost.conf → .docker/templates/default.conf.template
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
server {
listen 8080;
listen ${NGINX_PORT};
server_name localhost;
root /app/public;

# Custom project settings start
client_max_body_size 100m;
# Custom project settings end
root ${NGINX_WEB_ROOT};

client_max_body_size ${NGINX_MAX_BODY_SIZE};

location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}

# Protect files and directories from prying eyes.
location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|.tar|.gz|.bz2|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ {
deny all;
return 404;
}

location ~ ^/index\.php(/|$) {
fastcgi_buffers 16 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;

fastcgi_pass phpfpm:9000;
fastcgi_pass ${NGINX_FPM_SERVICE};
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;

Expand Down
22 changes: 16 additions & 6 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,22 @@ SELVBETJENING_USER_API_TOKEN=''
USER_SIGNATURE_HEIGHT='2cm'

# Set these in .env.local
#AZURE_KEY_VAULT_SF1601_NAME=''
#AZURE_KEY_VAULT_SF1601_SECRET=''
#AZURE_KEY_VAULT_SF1601_VERSION=''
AZURE_KEY_VAULT_SF1601_NAME=''
AZURE_KEY_VAULT_SF1601_SECRET=''
AZURE_KEY_VAULT_SF1601_VERSION=''

# Set this in .env.local
#SF1601_AUTHORITY_CVR=''
# Set these in .env.local
SF1601_AUTHORITY_CVR=''
SF1601_SENDER_LABEL='Aarhus Kommune'
#SF1601_FORSENDELSES_TYPE_IDENTIFIKATOR=''
SF1601_FORSENDELSES_TYPE_IDENTIFIKATOR='0'
SF1601_TEST_MODE='true'

# Set to `-1 day`, say, to effectively disable cache.
# Run `bin/console cache:pool:clear cache.app` after changing this.
SF1601_POST_FORESPOERG_CACHE_EXPIRE_AT='+1 day'

# Maximum attachment sizes for digital and physical post, respectively.
# 79691776 = 76 * 1024²
SF1601_DIGITAL_POST_MAX_SIZE=79691776
# 7340032 = 7 * 1024²
SF1601_PHYSICAL_POST_MAX_SIZE=7340032
12 changes: 6 additions & 6 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
php: [ '8.3' ]
name: Validate composer (${{ matrix.php}})
steps:
- name: Checkout
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
php: [ '8.3' ]
name: Unit tests (${{ matrix.php}})
steps:
- name: Checkout
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
# strategy:
# fail-fast: false
# matrix:
# php: [ '8.1' ]
# php: [ '8.3' ]
# steps:
# - name: Checkout
# uses: actions/checkout@v2
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
php: [ '8.3' ]
name: PHP Coding Standards Fixer (${{ matrix.php }})
steps:
- name: Checkout
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
php: [ '8.3' ]
name: Twigcs (${{ matrix.php }})
steps:
- name: Checkout
Expand Down Expand Up @@ -264,7 +264,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
php: [ '8.3' ]
name: Check translations are up to date (${{ matrix.php}})
steps:
- name: Checkout
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ about writing changes to this log.

## [Unreleased]

* [PR-401](https://github.com/itk-dev/naevnssekretariatet/pull/401)
- [PR-402](https://github.com/itk-dev/naevnssekretariatet/pull/402)
Optimized handling of digital post
- [PR-401](https://github.com/itk-dev/naevnssekretariatet/pull/401)
Update itk-dev/serviceplatformen
- [PR-399](https://github.com/itk-dev/naevnssekretariatet/pull/399)
Added `forsendelse-uuid` filtering option to
Expand Down
22 changes: 22 additions & 0 deletions assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,26 @@ const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]
window.addEventListener('load', () => {
[...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
window.dispatchEvent(new Event('ajaxload'))

const recipientSelector = '.digital-post-recipient'
const digitalPostRecipientWrapper = document.querySelector(recipientSelector)?.parentNode?.parentNode
const digitalPostAttachmentsInfo = document.querySelector('.digital-post-attachments-info')
if (digitalPostRecipientWrapper && digitalPostAttachmentsInfo) {
const recipients = digitalPostRecipientWrapper.querySelectorAll(recipientSelector)
const updateDigitalPostInfo = () => {
const recipientsThatCannotReceiveDigitalPost = [...recipients]
.filter(el => !el.dataset.digitalPostAllowed &&
el.querySelector('input[type="checkbox"]').checked);

// Show only the appropriate digital post message (cf.
// ../templates/common/digital_post_attachments_info.html.twig).
[...digitalPostAttachmentsInfo.querySelectorAll('.digital-post-attachments-info-item')]
.forEach(el => {
el.hidden = !(el.dataset.digitalPostAllowed ^ (recipientsThatCannotReceiveDigitalPost.length > 0))
})
}

[...recipients].forEach(el => el.addEventListener('change', (event) => updateDigitalPostInfo()))
updateDigitalPostInfo()
}
})
9 changes: 9 additions & 0 deletions assets/content/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ th, td {
text-align: right;
}
}

.digital-post-recipient,
.digital-post-attachments-info-item {
&[data-digital-post-allowed=""] {
.digital-post-message {
color: red;
}
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"itk-dev/beskedfordeler-symfony": "^1.0",
"itk-dev/datafordeler-php-client": "^1.0",
"itk-dev/openid-connect-bundle": "^3.1",
"itk-dev/serviceplatformen": "^1.5",
"itk-dev/serviceplatformen": "dev-feature/postForespoerg-types",
"knplabs/knp-paginator-bundle": "^5.6",
"league/oauth2-client": "^2.6",
"lexik/form-filter-bundle": "^7.0",
Expand All @@ -46,6 +46,7 @@
"sensio/framework-extra-bundle": "^5.1",
"stof/doctrine-extensions-bundle": "^1.7",
"symfony/asset": "5.4.*",
"symfony/cache": "5.4.*",
"symfony/console": "5.4.*",
"symfony/doctrine-messenger": "5.4.*",
"symfony/dotenv": "5.4.*",
Expand Down
44 changes: 23 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/packages/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ twig:
format_datetime: 'd/m/Y H:i'
format_weekday: 'l'
digital_post_envelope_helper: '@App\Service\DigitalPostEnvelopeHelper'
digital_poster: '@App\Service\SF1601\DigitalPoster'
form_themes: ['bootstrap_5_layout.html.twig', 'form/theme.html.twig']

date:
Expand Down
3 changes: 3 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ services:
sender_label: '%env(SF1601_SENDER_LABEL)%'
forsendelses_type_identifikator: '%env(int:SF1601_FORSENDELSES_TYPE_IDENTIFIKATOR)%'
test_mode: '%env(bool:SF1601_TEST_MODE)%'
post_forespoerg_cache_expire_at: '%env(SF1601_POST_FORESPOERG_CACHE_EXPIRE_AT)%'
digital_post_max_size: '%env(int:SF1601_DIGITAL_POST_MAX_SIZE)%'
physical_post_max_size: '%env(int:SF1601_PHYSICAL_POST_MAX_SIZE)%'

App\Retry\DigitalPostRetryStrategy:
arguments:
Expand Down
25 changes: 12 additions & 13 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# itk-version: 3.0.0
version: "3"

# itk-version: 3.2.1
services:
phpfpm:
environment:
- PHP_SENDMAIL_PATH='/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"'
- PHP_SENDMAIL_PATH=/usr/sbin/sendmail -S mail:1025

nginx:
labels:
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=ITKBasicAuth@file"

mailhog:
image: itkdev/mailhog
mail:
image: axllent/mailpit
restart: unless-stopped
networks:
- app
- frontend
labels:
- "traefik.enable=true"
- "traefik.docker.network=frontend"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.rule=Host(`mailhog.${COMPOSE_SERVER_DOMAIN}`)"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.rule=Host(`mail.${COMPOSE_SERVER_DOMAIN}`)"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.entrypoints=web"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}-http.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.rule=Host(`mailhog.${COMPOSE_SERVER_DOMAIN}`)"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
- "traefik.http.services.mailhog_${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=8025"
- "traefik.http.routers.mailhog_${COMPOSE_PROJECT_NAME}.middlewares=ITKMailhogAuth@file"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.rule=Host(`mail.${COMPOSE_SERVER_DOMAIN}`)"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
- "traefik.http.services.mail_${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=8025"
- "traefik.http.routers.mail_${COMPOSE_PROJECT_NAME}.middlewares=ITKMailhogAuth@file"
Loading
Loading