diff --git a/lib/Service/EventsService.php b/lib/Service/EventsService.php index 11502a64c..12bb218fc 100644 --- a/lib/Service/EventsService.php +++ b/lib/Service/EventsService.php @@ -126,21 +126,22 @@ public function __construct( * @param Circle $circle */ public function onCircleCreation(Circle $circle) { - if ($this->configService->getAppValue(ConfigService::CIRCLES_ACTIVITY_ON_CREATION) !== '1' - || ($circle->getType() !== Circle::CIRCLES_PUBLIC - && $circle->getType() !== Circle::CIRCLES_CLOSED)) { + if ($circle->getType() !== Circle::CIRCLES_PUBLIC + && $circle->getType() !== Circle::CIRCLES_CLOSED) { return; } - $event = $this->generateEvent('circles_as_non_member'); - $event->setSubject('circle_create', ['circle' => json_encode($circle)]); + if ($this->configService->getAppValue(ConfigService::CIRCLES_ACTIVITY_ON_CREATION) === '1') { + $event = $this->generateEvent('circles_as_non_member'); + $event->setSubject('circle_create', ['circle' => json_encode($circle)]); - $this->userManager->callForSeenUsers( - function($user) use ($event) { - /** @var IUser $user */ - $this->publishEvent($event, [$user]); - } - ); + $this->userManager->callForSeenUsers( + function($user) use ($event) { + /** @var IUser $user */ + $this->publishEvent($event, [$user]); + } + ); + } $this->dispatch('\OCA\Circles::onCircleCreation', ['circle' => $circle]); } @@ -213,6 +214,7 @@ public function onMemberNew(Circle $circle, Member $member) { ) ) ); + $this->dispatch('\OCA\Circles::onMemberNew', ['circle' => $circle, 'member' => $member]); $this->notificationOnMemberNew($circle, $member); @@ -340,6 +342,7 @@ public function onMemberLeaving(Circle $circle, Member $member) { ) ) ); + $this->dispatch('\OCA\Circles::onMemberLeaving', ['circle' => $circle, 'member' => $member]); $this->deleteNotification('membership', $member->getMemberId());