Skip to content

Commit

Permalink
Merge branch 'hotfix/v2.3.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Jun 14, 2024
2 parents 56e9168 + d7616a7 commit 7b7b3b2
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ IR_DRIVER=gd
MESSENGER_TRANSPORT_DSN=redis://redis:6379/messages
###< symfony/messenger ###

TRUSTED_PROXIES=127.0.0.1,172.19.0.1,172.19.0.2,REMOTE_ADDR
TRUSTED_PROXIES=REMOTE_ADDR

###> sentry/sentry-symfony ###
SENTRY_DSN=
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to Roadiz will be documented in this file.

## [2.3.10](https://github.com/roadiz/core-bundle-dev-app/compare/v2.3.9...v2.3.10) - 2024-06-14

### Bug Fixes

- Pass FormInterface to `bulkAction` to update bulk item with a form field data. - ([8d46507](https://github.com/roadiz/core-bundle-dev-app/commit/8d4650767dcaa183c135c4043ffd1cfea4dc64d6))

## [2.3.9](https://github.com/roadiz/core-bundle-dev-app/compare/v2.3.8...v2.3.9) - 2024-06-13

### Features
Expand Down
8 changes: 4 additions & 4 deletions docker/php82-fpm-alpine/docker-php-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ set -e
/bin/chown -R www-data:www-data /var/www/html/config || true;

# Print local env vars to .env.xxx.php file for performances and crontab jobs
/usr/bin/sudo -u www-data -- bash -c "/var/www/html/bin/console cache:clear -n"
/usr/bin/sudo -u www-data -- bash -c "/var/www/html/bin/console cache:pool:clear cache.global_clearer -n"
/usr/bin/sudo -u www-data -- bash -c "/var/www/html/bin/console assets:install -n"
/usr/bin/sudo -u www-data -- bash -c "/var/www/html/bin/console themes:assets:install -n Rozier --relative --symlink"
/usr/bin/sudo -E -u www-data -- bash -c "/var/www/html/bin/console cache:clear -n"
/usr/bin/sudo -E -u www-data -- bash -c "/var/www/html/bin/console cache:pool:clear cache.global_clearer -n"
/usr/bin/sudo -E -u www-data -- bash -c "/var/www/html/bin/console assets:install -n"
/usr/bin/sudo -E -u www-data -- bash -c "/var/www/html/bin/console themes:assets:install -n Rozier --relative --symlink"

#
# Wait for database to be ready for next commands and migrations
Expand Down
2 changes: 1 addition & 1 deletion lib/RoadizCoreBundle/config/services.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
parameters:
roadiz_core.cms_version: '2.3.9'
roadiz_core.cms_version: '2.3.10'
roadiz_core.cms_version_prefix: 'main'
env(APP_NAMESPACE): "roadiz"
env(APP_VERSION): "0.1.0"
Expand Down
29 changes: 26 additions & 3 deletions lib/Rozier/src/Controllers/AbstractAdminWithBulkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,36 @@ protected function parseFormBulkIds(?FormInterface $form): array
if (null === $form) {
return [];
}
$ids = \json_decode($form->getData() ?? '[]');
if (!$form->isSubmitted() || !$form->isValid()) {
return [];
}
$json = $form->getData();
if (is_string($json)) {
$json = stripslashes(trim($json, '"'));
} else {
return [];
}
$ids = \json_decode($json, true);

return \array_filter($ids, function ($id) {
// Allow int or UUID identifiers
return is_numeric($id) || is_string($id);
});
}

/**
* @param Request $request
* @param string $requiredRole
* @param FormInterface $bulkForm
* @param FormInterface $form
* @param callable(string): FormInterface $createBulkFormWithIds
* @param string $templatePath
* @param string $confirmMessageTemplate
* @param callable(PersistableInterface, FormInterface): void $alterItemCallable
* @param string $bulkFormName
* @return Response
* @throws \Twig\Error\RuntimeError
*/
protected function bulkAction(
Request $request,
string $requiredRole,
Expand All @@ -111,7 +134,7 @@ protected function bulkAction(
$items = $this->getRepository()->findBy([
'id' => $ids,
]);
$formWithIds = $createBulkFormWithIds(json_encode($ids));
$formWithIds = $createBulkFormWithIds(\json_encode($ids, JSON_THROW_ON_ERROR));
if (!$formWithIds instanceof FormInterface) {
throw new \RuntimeException('Invalid form returned.');
}
Expand All @@ -132,7 +155,7 @@ protected function bulkAction(
]);
foreach ($items as $item) {
if ($this->supports($item)) {
$alterItemCallable($item);
$alterItemCallable($item, $form);
$updateEvent = $this->createUpdateEvent($item);
if (null !== $updateEvent) {
$this->dispatchSingleOrMultipleEvent($updateEvent);
Expand Down
10 changes: 8 additions & 2 deletions lib/Rozier/src/Controllers/Users/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ function (string $ids) {
},
$this->getTemplateFolder() . '/bulk_enable.html.twig',
'%namespace%.%item%.was_enabled',
function (User $item) {
function (PersistableInterface $item) {
if (!$item instanceof User) {
throw new \RuntimeException('Invalid item type.');
}
$item->setEnabled(true);
},
'bulkEnableForm'
Expand All @@ -299,7 +302,10 @@ function (string $ids) {
},
$this->getTemplateFolder() . '/bulk_disable.html.twig',
'%namespace%.%item%.was_disabled',
function (User $item) {
function (PersistableInterface $item) {
if (!$item instanceof User) {
throw new \RuntimeException('Invalid item type.');
}
$item->setEnabled(false);
},
'bulkDisableForm'
Expand Down
6 changes: 5 additions & 1 deletion lib/Rozier/src/Resources/translations/messages.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,7 @@
</trans-unit>
<trans-unit xml:space="preserve" id="are_you_sure.delete.customFormAnswer" approved="yes">
<source>are_you_sure.delete.customFormAnswer</source>
<target state="final">Are you sure you want to delete delete this answer</target>
<target state="final">Are you sure you want to delete this custom-form answer?</target>
</trans-unit>
<trans-unit xml:space="preserve" id="delete.customFormAnswer.%name%" approved="yes">
<source>delete.customFormAnswer.%name%</source>
Expand Down Expand Up @@ -4876,6 +4876,10 @@
<source>sort_attributes_by_weight_for_this_type</source>
<target state="translated">If node-type is attributable, this option enforce attribute sorting by weight instead of manual position.</target>
</trans-unit>
<trans-unit xml:space="preserve" id="ip_address">
<source>ip_address</source>
<target state="translated">IP address</target>
</trans-unit>
</body>
</file>
</xliff>
6 changes: 5 additions & 1 deletion lib/Rozier/src/Resources/translations/messages.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,7 @@
</trans-unit>
<trans-unit xml:space="preserve" id="are_you_sure.delete.customFormAnswer" approved="yes">
<source>are_you_sure.delete.customFormAnswer</source>
<target state="final">Êtes-vous sûr(e) de vouloir supprimer ce formulaire personnalisé ?</target>
<target state="final">Êtes-vous sûr(e) de vouloir supprimer cette réponse de formulaire personnalisé ?</target>
</trans-unit>
<trans-unit xml:space="preserve" id="delete.customFormAnswer.%name%" approved="yes">
<source>delete.customFormAnswer.%name%</source>
Expand Down Expand Up @@ -4876,6 +4876,10 @@
<source>sort_attributes_by_weight_for_this_type</source>
<target state="translated">Si le type de nœud accepte les attributs, cette option force le tri des attributs par poids plutôt que par position manuelle.</target>
</trans-unit>
<trans-unit xml:space="preserve" id="ip_address">
<source>ip_address</source>
<target state="translated">Adresse IP</target>
</trans-unit>
</body>
</file>
</xliff>
1 change: 1 addition & 0 deletions lib/Rozier/src/Resources/translations/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@

<trans-unit xml:space="preserve" id="sortingAttributesByWeight"><source>sortingAttributesByWeight</source></trans-unit>
<trans-unit xml:space="preserve" id="sort_attributes_by_weight_for_this_type"><source>sort_attributes_by_weight_for_this_type</source></trans-unit>
<trans-unit xml:space="preserve" id="ip_address"><source>ip_address</source></trans-unit>
</body>
</file>
</xliff>
2 changes: 1 addition & 1 deletion lib/Rozier/src/Resources/views/panels/user_panel.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{% if (is_granted('ROLE_ACCESS_DOCTRINE_CACHE_DELETE')) %}
<a title="{% trans %}delete.caches{% endtrans %}"
data-uk-tooltip="{animation:true}"
class="uk-icon-button uk-icon-rz-flash"
class="uk-icon-button uk-icon-rz-flash rz-no-ajax-link"
href="{{ path('deleteDoctrineCache') }}"><span class="user-action-label">{% trans %}delete.caches{% endtrans %}</span></a>
{% endif %}
{% if (is_granted('ROLE_ACCESS_DOCTRINE_CACHE_DELETE')) %}
Expand Down
6 changes: 6 additions & 0 deletions lib/Rozier/src/Resources/views/users/edit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
<th>{% trans %}updated.at{% endtrans %}</th>
<td>{{ item.updatedAt|format_datetime('long', locale=app.request.locale) }}</td>
</tr>
{% if item.id == app.user.id %}
<tr>
<th>{% trans %}ip_address{% endtrans %}</th>
<td>{{ app.request.clientIp }}</td>
</tr>
{% endif %}
</table>
</div>
</article>
Expand Down

0 comments on commit 7b7b3b2

Please sign in to comment.