Skip to content

Commit

Permalink
Merge pull request #413 from nextcloud/backport/396/stable16
Browse files Browse the repository at this point in the history
[stable16] Better 'creation_activity' option handling
  • Loading branch information
ArtificialOwl authored Apr 10, 2020
2 parents 429895c + 9f397d8 commit 73366ee
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/Service/EventsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,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]);
}
Expand Down

0 comments on commit 73366ee

Please sign in to comment.