From 4736fca67959aa836f34f7ae4f4abbfd4ae715dd Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 30 Jan 2024 14:02:02 +0100 Subject: [PATCH] Fix the conditions upon which social actions should be optional or required in relation to social issues within the activity creation form --- src/Bundle/ChillActivityBundle/Entity/ActivityType.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index c14c8292b..2db0f805d 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -291,7 +291,9 @@ class ActivityType public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { - if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { + // if social issues are invisible then social actions cannot be optional or required + if social issues are optional then social actions shouldn't be required + if (0 === $this->socialIssuesVisible && (1 === $this->socialActionsVisible || 2 === $this->socialActionsVisible) + || (1 === $this->socialIssuesVisible && 2 === $this->socialActionsVisible)) { $context ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') ->atPath('socialActionsVisible')