Skip to content

Commit

Permalink
Return only the host as audience for remote magazines (#1039)
Browse files Browse the repository at this point in the history
Co-authored-by: Melroy van den Berg <[email protected]>
  • Loading branch information
BentiGorlich and melroy89 authored Aug 19, 2024
1 parent c5fe0f4 commit 9b94f5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/MessageHandler/ActivityPub/Outbox/CreateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function doWork(MessageInterface $message): void
...$this->activityPubManager->createInboxesFromCC($activity, $entity->user),
...$this->magazineRepository->findAudience($entity->magazine),
];
$this->logger->debug('sending create activity to {p}', ['p' => $receivers]);
}
$this->deliverManager->deliver(array_filter(array_unique($receivers)), $activity);
}
Expand Down
4 changes: 4 additions & 0 deletions src/Repository/MagazineRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ private function getOverviewIds(array $result, string $type): array

public function findAudience(Magazine $magazine): array
{
if (null !== $magazine->apId) {
return [$magazine->apInboxUrl];
}

$dql =
'SELECT COUNT(u.id), u.apInboxUrl FROM '.User::class.' u WHERE u IN ('.
'SELECT IDENTITY(ms.user) FROM '.MagazineSubscription::class.' ms WHERE ms.magazine = :magazine)'.
Expand Down

0 comments on commit 9b94f5a

Please sign in to comment.