[PLUGINS][Favourite][RepeatNote][DeleteNote][WebMonetization] Make use of 'activitypub_handler' more readable

This commit is contained in:
2022-03-10 00:40:54 +00:00
parent 9a9eed1457
commit 0ce5eba355
4 changed files with 26 additions and 24 deletions

View File

@@ -376,7 +376,8 @@ class RepeatNote extends NoteHandlerPlugin
} else {
return Event::next;
}
} else { // Undo Repeat
$activity = self::repeatNote($note ?? Note::getById($note_id), $actor->getId(), source: 'ActivityPub');
} elseif ($type_activity->get('type') === 'Undo') { // Undo Repeat
if ($type_object instanceof \ActivityPhp\Type\AbstractObject) {
$ap_prev_repeat_act = \Plugin\ActivityPub\Util\Model\Activity::fromJson($type_object);
$prev_repeat_act = $ap_prev_repeat_act->getActivity();
@@ -394,13 +395,11 @@ class RepeatNote extends NoteHandlerPlugin
} else {
return Event::next;
}
$activity = self::unrepeatNote($note_id, $actor->getId(), source: 'ActivityPub');
} else {
return Event::next;
}
if ($type_activity->get('type') === 'Announce') {
$activity = self::repeatNote($note ?? Note::getById($note_id), $actor->getId(), source: 'ActivityPub');
} else {
$activity = self::unrepeatNote($note_id, $actor->getId(), source: 'ActivityPub');
}
if (!\is_null($activity)) {
// Store ActivityPub Activity
$ap_act = \Plugin\ActivityPub\Entity\ActivitypubActivity::create([