Skip to content
Snippets Groups Projects
Commit c5d74f05 authored by Jonathan Foucher's avatar Jonathan Foucher
Browse files

fix notification filter for managers. Fixes #919

parent c316100c
No related branches found
No related tags found
1 merge request!300v2.4.6 - Fix divers
Pipeline #77798 failed
......@@ -29,6 +29,7 @@ use App\Application\Symfony\Security\UserProvider;
use App\Application\Traits\ServersideDatatablesTrait;
use App\Domain\Notification\Model;
use App\Domain\Notification\Model\Notification;
use App\Domain\Notification\Model\NotificationUser;
use App\Domain\Notification\Repository;
use App\Domain\User\Dictionary\UserMoreInfoDictionary;
use App\Domain\User\Dictionary\UserRoleDictionary;
......@@ -274,7 +275,7 @@ class NotificationController extends CRUDController
$notification->setReadAt(new \DateTime());
$notification->setReadBy($this->getUser());
} else {
$nu = $notification->getNotificationUsers()->filter(function ($i, $n) use ($user) {
$nu = $notification->getNotificationUsers()->filter(function ($n) use ($user) {
/* @var Model\NotificationUser $n */
return $n->getUser() && $n->getUser()->getId() === $user->getId();
})->first();
......@@ -331,6 +332,7 @@ class NotificationController extends CRUDController
*/
public function markAsUnreadAction(Request $request, string $id)
{
/** @var Notification $notification */
$notification = $this->repository->findOneByID($id);
if (!$notification) {
throw new NotFoundHttpException('Notification introuvable');
......@@ -342,8 +344,7 @@ class NotificationController extends CRUDController
$this->entityManager->flush();
} else {
$user = $this->userProvider->getAuthenticatedUser();
$nu = $notification->getNotificationUsers()->filter(function ($i, $n) use ($user) {
/* @var Model\NotificationUser $n */
$nu = $notification->getNotificationUsers()->filter(function (NotificationUser $n) use ($user) {
return $n->getUser() && $n->getUser()->getId() === $user->getId();
})->first();
if ($nu) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment