diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 9f7457990..63a886289 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -20,6 +20,7 @@ use OCA\Circles\Exceptions\MemberNotFoundException; use OCA\Circles\Exceptions\RequestBuilderException; use OCA\Circles\Exceptions\SingleCircleNotFoundException; +use OCA\Circles\Model\Member; use OCA\Circles\Model\Probes\CircleProbe; use OCA\Circles\Service\ConfigService; use OCA\Circles\Service\FederatedUserService; @@ -153,6 +154,7 @@ public function prepare(INotification $notification, string $languageCode): INot * @throws InvalidIdException * @throws SingleCircleNotFoundException * @throws UnknownNotificationException + * @throws AlreadyProcessedException */ private function prepareMemberNotification(INotification $notification) { $this->federatedUserService->initCurrentUser($notification->getUser()); @@ -167,6 +169,10 @@ private function prepareMemberNotification(INotification $notification) { $probe ); + if ($notification->getSubject() === 'joinRequest' && $member->getStatus() !== Member::STATUS_REQUEST) { + throw new AlreadyProcessedException(); + } + switch ($notification->getSubject()) { case 'memberAdd': $subject = $this->l10n->t(