From c7cdb3a092649b895eae9a66b7a4f7351e35f5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 18 Jul 2023 06:37:26 +0000 Subject: [PATCH 01/32] Add CONTRIBUTING --- CONTRIBUTING.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..16a323415 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,80 @@ +# Contributing + +Chill is an open source, community-driven project. + +If you'd like to contribute, please read the following. + +## What can you do ? + +Chill is an open-source project driven by a community of developers, users and social workers. If you don't feel ready to contribute code or patches, reviewing issues and pull requests (PRs) can be a great start to get involved and give back. + +If you don't have your own instance or don't want to use it, you can try to reproduce bugs using the instance https://demo.chill.social + +## Core team + +The core team is the group of developers that determine the direction and evolution of the Chill project. Their votes rule if the features and patches proposed by the community are approved or rejected. + +All the Chill Core members are long-time contributors with solid technical expertise and they have demonstrated a strong commitment to drive the project forward. + +The core team: + +- elects his own members; +- merge pull requests; + +### members + +Project leader: [julienfastre](https://gitlab.com/julienfastre) + +Core members: + +- [tchama](https://gitlab.com/tchama) +- [LenaertsJ](https://gitlab.com/LenaertsJ) +- [nobohan](https://gitlab.com/nobohan) + +### Becoming a project member + +About once a year, the core team discusses the opportunity to invite new members. To become a core team member, you must: + +- take part on the development for at least 6 month; +- through this participation, demonstrate your technical skills and your knowledge of the software and any of their dependencies; + +### Core Membership Revocation + +A Symfony Core membership can be revoked for any of the following reasons: + +- Refusal to follow the rules and policies stated in this document; +- Lack of activity for the past six months; +- Willful negligence or intent to harm the Chill project; + +The decision is taken by the majority of project members. + +## Code development rules + +### Merge requests + +Every merge request must contains: + +- one more entries suitable for generating a changelog. This is done using the [changie utility](https://changie.dev); +- a comprehensible description of the changes; +- if applicable, automated tests should be adapted or created; +- the code style must pass the project's rules, and non phpstan errors must be raised nor rector refactoring suggestion. + +The pipelines must pass. + +In case of emergency, some rules may be temporarily ignored. + +### Merge Request Voting Policy + +- -1 votes must always be justified by technical and objective reasons; +- +1 (technically: approbation on the merge request) votes do not require justification, unless there is at least one -1 vote; +- Core members can change their votes as many times as they desire during the course of a merge request discussion; +- Core members are not allowed to vote on their own merge requests. + +### Merge Request Merging Process + +All code must be committed to the repository through merge requests, except for minor changes which can be committed directly to the repository. + +### Release Policy + +The Core members are also the release manager for every Chill version. + From 15bf4d6d6d4b10e3efdfe01d8dcac4a79b2d9ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 18 Jul 2023 06:42:21 +0000 Subject: [PATCH 02/32] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16a323415..20b03f783 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,7 +35,7 @@ Core members: About once a year, the core team discusses the opportunity to invite new members. To become a core team member, you must: -- take part on the development for at least 6 month; +- take part on the development for at least 6 month: propose multiple merge requests and participate to the peer review process; - through this participation, demonstrate your technical skills and your knowledge of the software and any of their dependencies; ### Core Membership Revocation From 767ed89f80f8cb28de0ca4a8d621bcf8abf91517 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 20 Jul 2023 10:52:22 +0200 Subject: [PATCH 03/32] FIX [document][list] 'or' query statements were not added to query for rendez vous documents causing all rendez-vous documents from all users to appear in dossiers that had a parcours. 'Or' statements add to where clause --- .../AccompanyingPeriodCalendarGenericDocProvider.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php index c33ccd853..981cfe3e5 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php @@ -147,6 +147,9 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen return $query; } + + $query->addWhereClause(implode(" OR ", $or), $orParams, $orTypes); + return $this->addWhereClausesToQuery($query, $startDate, $endDate, $content); } @@ -185,6 +188,8 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen ); } + dump($query); + return $query; } From 032eed0424d6252b4a241eba9e4ae8e3e16de9e1 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 20 Jul 2023 11:37:59 +0200 Subject: [PATCH 04/32] DX add changie --- .changes/unreleased/Fixed-20230720-112046.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixed-20230720-112046.yaml diff --git a/.changes/unreleased/Fixed-20230720-112046.yaml b/.changes/unreleased/Fixed-20230720-112046.yaml new file mode 100644 index 000000000..f32caab7b --- /dev/null +++ b/.changes/unreleased/Fixed-20230720-112046.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Rendez-vous documents created would appear in all documents lists of all persons + with a parcours. Or statements were not added to the where clause. +time: 2023-07-20T11:20:46.124104967+02:00 +custom: + Issue: "132" From 9846cd5acbbd954514a1cfe294c3058b91f8aac2 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 20 Jul 2023 12:12:34 +0200 Subject: [PATCH 05/32] DX phpstan, csfix, remove dumps --- .../Providers/AccompanyingPeriodCalendarGenericDocProvider.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php index 981cfe3e5..6675f7c7e 100644 --- a/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php +++ b/src/Bundle/ChillCalendarBundle/Service/GenericDoc/Providers/AccompanyingPeriodCalendarGenericDocProvider.php @@ -188,8 +188,6 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen ); } - dump($query); - return $query; } From b7a6a88e70e1aa191aec99569f0c8e89fb9bc35f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 20 Jul 2023 12:24:26 +0200 Subject: [PATCH 06/32] DX run changie to batch and merge --- .changes/unreleased/Fixed-20230720-112046.yaml | 6 ------ CHANGELOG.md | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 .changes/unreleased/Fixed-20230720-112046.yaml diff --git a/.changes/unreleased/Fixed-20230720-112046.yaml b/.changes/unreleased/Fixed-20230720-112046.yaml deleted file mode 100644 index f32caab7b..000000000 --- a/.changes/unreleased/Fixed-20230720-112046.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: Rendez-vous documents created would appear in all documents lists of all persons - with a parcours. Or statements were not added to the where clause. -time: 2023-07-20T11:20:46.124104967+02:00 -custom: - Issue: "132" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bd041441..cd9f4683a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v2.5.3 - 2023-07-20 +### Fixed +* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous. + ## v2.5.2 - 2023-07-15 ### Fixed * [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead) From 95b3933650f4a85ddca8b571d9946ab8d0663a81 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 20 Jul 2023 12:30:51 +0200 Subject: [PATCH 07/32] Version 2.5.3 --- .changes/v2.5.3.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changes/v2.5.3.md diff --git a/.changes/v2.5.3.md b/.changes/v2.5.3.md new file mode 100644 index 000000000..164a0712a --- /dev/null +++ b/.changes/v2.5.3.md @@ -0,0 +1,3 @@ +## v2.5.3 - 2023-07-20 +### Fixed +* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous. From 01e9a15bd71f51fdd8662a5465b02a1cebf66632 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 21 Aug 2023 10:09:34 +0200 Subject: [PATCH 08/32] FIX [sort][center] sort list of centers in admin alphabetically --- src/Bundle/ChillMainBundle/Controller/CenterController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Controller/CenterController.php b/src/Bundle/ChillMainBundle/Controller/CenterController.php index 64d9a4527..1cc129e5d 100644 --- a/src/Bundle/ChillMainBundle/Controller/CenterController.php +++ b/src/Bundle/ChillMainBundle/Controller/CenterController.php @@ -77,6 +77,8 @@ class CenterController extends AbstractController $entities = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->findAll(); + usort($entities, fn (Center $a, Center $b) => $a->getName() <=> $b->getName()); + return $this->render('@ChillMain/Center/index.html.twig', [ 'entities' => $entities, ]); From 87cdf2e53b40c3bc9b2ce916ec58c486f890b3b9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 22 Aug 2023 14:24:40 +0200 Subject: [PATCH 09/32] Fixed: [export] bad type in form of EmergencyFilter and CalendarRangeFilter --- .../Export/Filter/ACPFilters/EmergencyFilter.php | 6 +++--- .../Export/Filter/CalendarRangeFilter.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php index 807ba3903..66ab40e48 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php @@ -22,11 +22,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; class EmergencyFilter implements FilterInterface { private const CHOICES = [ - 'activity is emergency' => true, - 'activity is not emergency' => false, + 'activity is emergency' => 'true', + 'activity is not emergency' => 'false', ]; - private const DEFAULT_CHOICE = false; + private const DEFAULT_CHOICE = 'false'; private TranslatorInterface $translator; diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php index 5ffb7c01f..84ec77e6b 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php @@ -29,11 +29,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; class CalendarRangeFilter implements FilterInterface { private const CHOICES = [ - 'Not made within a calendar range' => true, - 'Made within a calendar range' => false, + 'Not made within a calendar range' => 'true', + 'Made within a calendar range' => 'false', ]; - private const DEFAULT_CHOICE = false; + private const DEFAULT_CHOICE = 'false'; private TranslatorInterface $translator; From 9ccbba2debbeefc76192bd412374b5a75ba8a731 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 22 Aug 2023 14:28:35 +0200 Subject: [PATCH 10/32] add changie --- .changes/unreleased/Fixed-20230822-142809.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixed-20230822-142809.yaml diff --git a/.changes/unreleased/Fixed-20230822-142809.yaml b/.changes/unreleased/Fixed-20230822-142809.yaml new file mode 100644 index 000000000..b22477135 --- /dev/null +++ b/.changes/unreleased/Fixed-20230822-142809.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: "Corrects a typing error in 2 filters, which caused an \nerror when trying to + reedit a saved export\n\n" +time: 2023-08-22T14:28:09.485466139+02:00 +custom: + Issue: "135" From dcae15e8d86d9e45f8e33d4ad1c3398fe7ce4b75 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 24 Aug 2023 15:14:47 +0200 Subject: [PATCH 11/32] Fixed: [notificationMailer] invert 'if continue' condition inside foreach loop --- .changes/unreleased/Fixed-20230824-152038.yaml | 6 ++++++ .../Notification/Email/NotificationMailer.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixed-20230824-152038.yaml diff --git a/.changes/unreleased/Fixed-20230824-152038.yaml b/.changes/unreleased/Fixed-20230824-152038.yaml new file mode 100644 index 000000000..656bd4752 --- /dev/null +++ b/.changes/unreleased/Fixed-20230824-152038.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Fix who receive reply notification when adding comment (recipees must receive + it, and sender not). +time: 2023-08-24T15:20:38.472382872+02:00 +custom: + Issue: "137" diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php index 5290492b1..a652231ac 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -46,7 +46,7 @@ class NotificationMailer [$comment->getNotification()->getSender()] ) as $dest ) { - if (null === $dest->getEmail() || $comment->getCreatedBy() !== $dest) { + if (null !== $dest->getEmail() && $comment->getCreatedBy() === $dest) { continue; } $email = new TemplatedEmail(); From f3fbd5314a0d5c0bb87249e6974cb9260aea489d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Sep 2023 15:47:45 +0200 Subject: [PATCH 12/32] Add test to NotificationMailer::postPersistComment --- .../Email/NotificationMailerTest.php | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php diff --git a/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php b/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php new file mode 100644 index 000000000..47629b4b4 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php @@ -0,0 +1,78 @@ +expectNotToPerformAssertions(); + $user1 = (new User())->setEmail('user1@foo.com'); + $user2 = (new User())->setEmail('user2@foo.com'); + $user3 = (new User())->setEmail('user3@foo.com'); + + $notification = new Notification(); + $notification + ->setTitle('test notification') + ->setSender($user1) + ->addAddressee($user2) + ->addAddressee($user3) + ; + + $comment = (new NotificationComment()) + ->setContent("foo bar baz") + ->setCreatedBy($user2) + ; + $notification->addComment($comment); + + $mailer = $this->prophesize(MailerInterface::class); + + // a mail only to user1 and user3 should have been sent + $mailer->send(Argument::that(function (Email $email) { + foreach ($email->getTo() as $address) { + if ($address->getAddress() === 'user1@foo.com' || $address->getAddress() === 'user3@foo.com') { + return true; + } + } + + return false; + })); + + $objectManager = $this->prophesize(EntityManagerInterface::class); + + $mailer = $this->buildNotificationMailer($mailer->reveal()); + $mailer->postPersistComment($comment, new PostPersistEventArgs($comment, $objectManager->reveal())); + } + + private function buildNotificationMailer( + MailerInterface $mailer = null, + ): NotificationMailer + { + return new NotificationMailer( + $mailer, + new NullLogger(), + new Translator('fr') + ); + } + + + +} From 40a72d9fca746704af7038190dfa633b0d5ce5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Sep 2023 15:47:59 +0200 Subject: [PATCH 13/32] NotificationMailer: send to correct destinees --- .../unreleased/Fixed-20230824-152038.yaml | 6 ------ .../unreleased/Fixed-20230906-154856.yaml | 5 +++++ .../Notification/Email/NotificationMailer.php | 19 ++++++++++++------- 3 files changed, 17 insertions(+), 13 deletions(-) delete mode 100644 .changes/unreleased/Fixed-20230824-152038.yaml create mode 100644 .changes/unreleased/Fixed-20230906-154856.yaml diff --git a/.changes/unreleased/Fixed-20230824-152038.yaml b/.changes/unreleased/Fixed-20230824-152038.yaml deleted file mode 100644 index 656bd4752..000000000 --- a/.changes/unreleased/Fixed-20230824-152038.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: Fix who receive reply notification when adding comment (recipees must receive - it, and sender not). -time: 2023-08-24T15:20:38.472382872+02:00 -custom: - Issue: "137" diff --git a/.changes/unreleased/Fixed-20230906-154856.yaml b/.changes/unreleased/Fixed-20230906-154856.yaml new file mode 100644 index 000000000..73fb2dc48 --- /dev/null +++ b/.changes/unreleased/Fixed-20230906-154856.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: Do not send an email to creator twice when adding a comment to a notification +time: 2023-09-06T15:48:56.991246312+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php index a652231ac..8facf00b9 100644 --- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php @@ -40,13 +40,18 @@ class NotificationMailer public function postPersistComment(NotificationComment $comment, PostPersistEventArgs $eventArgs): void { - foreach ( - array_merge( - $comment->getNotification()->getAddressees()->toArray(), - [$comment->getNotification()->getSender()] - ) as $dest - ) { - if (null !== $dest->getEmail() && $comment->getCreatedBy() === $dest) { + $dests = [$comment->getNotification()->getSender(), ...$comment->getNotification()->getAddressees()->toArray()]; + + $uniqueDests = []; + foreach ($dests as $dest) { + // avoid duplication + if (in_array(spl_object_hash($dest), $uniqueDests, true)) { + continue; + } + $uniqueDests[] = spl_object_hash($dest); + + // do not send if the sender does not have any email, nor to the creator of the comment + if (null === $dest->getEmail() || $comment->getCreatedBy() === $dest) { continue; } $email = new TemplatedEmail(); From 53cc43f8d30ace37ad07bb027cb15547736886b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Sep 2023 15:55:01 +0200 Subject: [PATCH 14/32] NotificationMailer: add tests when user does not have any email --- .../Email/NotificationMailerTest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php b/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php index 47629b4b4..4c1ae5d42 100644 --- a/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php @@ -62,6 +62,46 @@ class NotificationMailerTest extends TestCase $mailer->postPersistComment($comment, new PostPersistEventArgs($comment, $objectManager->reveal())); } + public function testPostPersistCommentDestWithNullEmail(): void + { + $this->expectNotToPerformAssertions(); + $user1 = (new User())->setEmail('user1@foo.com'); + $user2 = (new User())->setEmail('user2@foo.com'); + $user3 = (new User())->setEmail(null); + + $notification = new Notification(); + $notification + ->setTitle('test notification') + ->setSender($user1) + ->addAddressee($user2) + ->addAddressee($user3) + ; + + $comment = (new NotificationComment()) + ->setContent("foo bar baz") + ->setCreatedBy($user2) + ; + $notification->addComment($comment); + + $mailer = $this->prophesize(MailerInterface::class); + + // a mail only to user1 and user3 should have been sent + $mailer->send(Argument::that(function (Email $email) { + foreach ($email->getTo() as $address) { + if ($address->getAddress() === 'user1@foo.com') { + return true; + } + } + + return false; + })); + + $objectManager = $this->prophesize(EntityManagerInterface::class); + + $mailer = $this->buildNotificationMailer($mailer->reveal()); + $mailer->postPersistComment($comment, new PostPersistEventArgs($comment, $objectManager->reveal())); + } + private function buildNotificationMailer( MailerInterface $mailer = null, ): NotificationMailer From 34ee2b3ba5f59677ea064f10cef057b177c0fdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 6 Sep 2023 16:18:28 +0200 Subject: [PATCH 15/32] Fix new CS --- .../ChillEventBundle/Search/EventSearch.php | 2 +- .../Email/NotificationMailerTest.php | 30 +++++++++++++------ .../Controller/PersonController.php | 2 +- .../AccompanyingPeriodContextTest.php | 2 +- .../DocGenerator/PersonContextTest.php | 2 +- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index 6bb3d435d..504d04130 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -152,7 +152,7 @@ class EventSearch extends AbstractSearch $orWhere = $qb->expr()->orX(); foreach ($reachableCenters as $center) { - $n = $n+1; + $n = $n + 1; $circles = $this->authorizationHelper->getReachableScopes( $this->security->getUser(), 'CHILL_EVENT_SEE', diff --git a/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php b/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php index 4c1ae5d42..19da87b79 100644 --- a/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Notification/Email/NotificationMailerTest.php @@ -1,5 +1,14 @@ setSender($user1) ->addAddressee($user2) ->addAddressee($user3) - ; + ; $comment = (new NotificationComment()) ->setContent("foo bar baz") @@ -47,14 +60,14 @@ class NotificationMailerTest extends TestCase // a mail only to user1 and user3 should have been sent $mailer->send(Argument::that(function (Email $email) { - foreach ($email->getTo() as $address) { - if ($address->getAddress() === 'user1@foo.com' || $address->getAddress() === 'user3@foo.com') { - return true; - } + foreach ($email->getTo() as $address) { + if ($address->getAddress() === 'user1@foo.com' || $address->getAddress() === 'user3@foo.com') { + return true; } + } - return false; - })); + return false; + })); $objectManager = $this->prophesize(EntityManagerInterface::class); @@ -104,8 +117,7 @@ class NotificationMailerTest extends TestCase private function buildNotificationMailer( MailerInterface $mailer = null, - ): NotificationMailer - { + ): NotificationMailer { return new NotificationMailer( $mailer, new NullLogger(), diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 2d4732289..ce6d6bb38 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -214,7 +214,7 @@ final class PersonController extends AbstractController { $person = new Person(); - $authorizedCenters =$this->authorizationHelper->getReachableCenters($this->getUser(), PersonVoter::CREATE); + $authorizedCenters = $this->authorizationHelper->getReachableCenters($this->getUser(), PersonVoter::CREATE); if (1 === count($authorizedCenters)) { $person->setCenter($authorizedCenters[0]); diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/AccompanyingPeriodContextTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/AccompanyingPeriodContextTest.php index f9f888999..b5f656702 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/AccompanyingPeriodContextTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/AccompanyingPeriodContextTest.php @@ -108,7 +108,7 @@ class AccompanyingPeriodContextTest extends KernelTestCase ): void { $context = $this->buildContext(); $template = new DocGeneratorTemplate(); - $template->setName(["fr" =>"test"])->setContext(AccompanyingPeriodContext::class) + $template->setName(["fr" => "test"])->setContext(AccompanyingPeriodContext::class) ->setDescription("description")->setActive(true) ->setOptions($options); diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php index 71fce8c92..fa99a5363 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php @@ -102,7 +102,7 @@ final class PersonContextTest extends KernelTestCase self::$container->get(ThirdPartyRepository::class) ); $template = new DocGeneratorTemplate(); - $template->setName(["fr" =>"test"])->setContext(AccompanyingPeriodContext::class) + $template->setName(["fr" => "test"])->setContext(AccompanyingPeriodContext::class) ->setDescription("description")->setActive(true) ->setOptions($options); From 16fcd03a02328ae1b6bb5fe00a04eb064b109943 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 24 Aug 2023 14:32:50 +0200 Subject: [PATCH 16/32] Fixed: [vuejs] fix missing translation in HouseholdMembersEditor component --- .../vuejs/HouseholdMembersEditor/components/PersonComment.vue | 2 +- .../Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue index cb9a02d51..8f61a74d1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/PersonComment.vue @@ -1,7 +1,7 @@