Skip to content

Commit

Permalink
Fix handling inbox FlagMessages
Browse files Browse the repository at this point in the history
- fix using wrong indexes
  • Loading branch information
BentiGorlich committed Nov 11, 2023
1 parent c89eab8 commit f6194b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/MessageHandler/ActivityPub/Inbox/FlagHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ private function findLocalSubject(string $apUrl): ?ReportInterface
{
$matches = null;
if (preg_match_all("/\/m\/([a-zA-Z0-9\-_:]+)\/t\/([1-9][0-9]*)\/-\/comment\/([1-9][0-9]*)/", $apUrl, $matches)) {
return $this->entryCommentRepository->findOneBy(['id' => $matches[0][3]]);
return $this->entryCommentRepository->findOneBy(['id' => $matches[3][0]]);
}
if (preg_match_all("/\/m\/([a-zA-Z0-9\-_:]+)\/t\/([1-9][0-9]*)/", $apUrl, $matches)) {
return $this->entryRepository->findOneBy(['id' => $matches[0][2]]);
return $this->entryRepository->findOneBy(['id' => $matches[2][0]]);
}
if (preg_match_all("/\/m\/([a-zA-Z0-9\-_:]+)\/p\/([1-9][0-9]*)\/-\/reply\/([1-9][0-9]*)/", $apUrl, $matches)) {
return $this->postCommentRepository->findOneBy(['id' => $matches[0][3]]);
return $this->postCommentRepository->findOneBy(['id' => $matches[3][0]]);
}
if (preg_match_all("/\/m\/([a-zA-Z0-9\-_:]+)\/p\/([1-9][0-9]*)/", $apUrl, $matches)) {
return $this->postRepository->findOneBy(['id' => $matches[0][2]]);
return $this->postRepository->findOneBy(['id' => $matches[2][0]]);
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/MessageHandler/ActivityPub/Outbox/FlagHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function build(Report $report, string $objectUrl): array

return [
'@context' => $context,
'id' => 'https://' . $this->settingsManager->get('KBIN_DOMAIN').'/activities/reports/' . $report->getId(),
'id' => 'https://'.$this->settingsManager->get('KBIN_DOMAIN').'/activities/reports/'.$report->getId(),
'type' => 'Flag',
'actor' => $report->reporting->apPublicUrl ?? $this->urlGenerator->generate('ap_user', ['username' => $report->reporting->username], UrlGeneratorInterface::ABSOLUTE_URL),
'to' => [$report->magazine->apPublicUrl ?? $this->urlGenerator->generate('ap_magazine', ['name' => $report->magazine->name], UrlGeneratorInterface::ABSOLUTE_URL)],
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ActivityPubManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function updateMagazine(string $actorUrl): ?Magazine

if (null !== $items) {
$moderatorsToRemove = [];
foreach ($magazine->moderators as /** @var $mod Moderator */ $mod) {
foreach ($magazine->moderators as /* @var $mod Moderator */ $mod) {
if (!$mod->isOwner) {
$moderatorsToRemove[] = $mod->user;
}
Expand Down

0 comments on commit f6194b2

Please sign in to comment.