diff --git a/CHANGELOG.md b/CHANGELOG.md
index 549276554..dc3a8da23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,12 @@ and this project adheres to
* [person] name suggestions within create person form when person is created departing from a search input (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/377)
+* [notification: formulaire création] descend la box avec la description dans le bas du formulaire
+* [notification for activity]: fix link to activity
+* [notification] add "URGENT" before accompanying course with emergency = true
+* [notification] add a "read more" button on system notification
+* [notification] add `[Chill]` in the subject of each notification, automatically
+* [notification] add a counter for notification in activity list and accompanying period list, and search results
* [parcours] bugfix if deathdate is not defined (eg. for a thirdparty) parcours is still displayed. Gave error before.
## Test releases
diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
index 6db1f6945..2947fda38 100644
--- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
+++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
@@ -31,6 +31,7 @@ use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use InvalidArgumentException;
use Psr\Log\LoggerInterface;
+use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@@ -38,8 +39,8 @@ use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Role\Role;
-use Symfony\Component\Serializer\SerializerInterface;
+use Symfony\Component\Serializer\SerializerInterface;
use function array_key_exists;
final class ActivityController extends AbstractController
@@ -471,20 +472,21 @@ final class ActivityController extends AbstractController
public function showAction(Request $request, int $id): Response
{
- $view = null;
+ $entity = $this->activityRepository->find($id);
- [$person, $accompanyingPeriod] = $this->getEntity($request);
+ if (null === $entity) {
+ throw $this->createNotFoundException('Unable to find Activity entity.');
+ }
+
+ $accompanyingPeriod = $entity->getAccompanyingPeriod();
+ $person = $entity->getPerson();
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:showAccompanyingCourse.html.twig';
} elseif ($person instanceof Person) {
$view = 'ChillActivityBundle:Activity:showPerson.html.twig';
- }
-
- $entity = $this->activityRepository->find($id);
-
- if (null === $entity) {
- throw $this->createNotFoundException('Unable to find Activity entity.');
+ } else {
+ throw new RuntimeException('the activity should be linked with a period or person');
}
if (null !== $accompanyingPeriod) {
@@ -493,8 +495,7 @@ final class ActivityController extends AbstractController
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
}
- // TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
- // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
+ $this->denyAccessUnlessGranted(ActivityVoter::SEE, $entity);
$deleteForm = $this->createDeleteForm($entity->getId(), $person, $accompanyingPeriod);
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig
index a64142863..6b0639a27 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list.html.twig
@@ -1,58 +1,64 @@
{% macro recordAction(activity, context = null, person_id = null, accompanying_course_id = null) %}
- {% if no_action is not defined or no_action == false %}
-
- {% endif %}
- {% if context == 'person' and activity.accompanyingPeriod is not empty %}
- {#
- Disable person_id in following links, for redirect to accompanyingCourse context
- #}
- {% set person_id = null %}
- {% set accompanying_course_id = activity.accompanyingPeriod.id %}
-
- {% if no_action is not defined or no_action == false %}
- {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
+ {% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
+ {% if no_action is not defined or no_action == false %}
+ {% set notif_counter = chill_count_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) %}
+ {% if notif_counter.total > 0 %}
+
{% endif %}
- {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
+ {% if context == 'person' and activity.accompanyingPeriod is not empty %}
+ {#
+ Disable person_id in following links, for redirect to accompanyingCourse context
+ #}
+ {% set person_id = null %}
+ {% set accompanying_course_id = activity.accompanyingPeriod.id %}