Skip to content

Commit

Permalink
Mark signup notification as read, after clicking on the link (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
melroy89 authored Feb 7, 2025
1 parent 3bf5d1e commit eebe806
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Controller/Admin/AdminSignupRequestsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Controller\AbstractController;
use App\Entity\User;
use App\Repository\NotificationRepository;
use App\Repository\UserRepository;
use App\Service\UserManager;
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
Expand All @@ -18,6 +19,7 @@ class AdminSignupRequestsController extends AbstractController
public function __construct(
private readonly UserRepository $repository,
private readonly UserManager $userManager,
private readonly NotificationRepository $notificationRepository,
) {
}

Expand All @@ -31,6 +33,9 @@ public function requests(#[MapQueryParameter] ?int $page = 1, #[MapQueryParamete
if ($signupRequest = $this->repository->findSignupRequest($username)) {
$requests[] = $signupRequest;
}
$user = $this->repository->findOneBy(['username' => $username]);
// Always mark the notifications as read, even if the user does not have any signup requests anymore
$this->notificationRepository->markUserSignupNotificationsAsRead($this->getUserOrThrow(), $user);
}

return $this->render('admin/signup_requests.html.twig', [
Expand Down

0 comments on commit eebe806

Please sign in to comment.