Remove all posts of a given inbox
This commit is contained in:
parent
2049fbce91
commit
2595b5e12f
1 changed files with 12 additions and 3 deletions
|
@ -49,12 +49,21 @@ class APDelivery
|
||||||
if (ActivityPub\Transmitter::archivedInbox($inbox)) {
|
if (ActivityPub\Transmitter::archivedInbox($inbox)) {
|
||||||
Logger::info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
|
Logger::info('Inbox is archived', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
|
||||||
if (in_array($cmd, [Delivery::POST])) {
|
if (in_array($cmd, [Delivery::POST])) {
|
||||||
if (empty($uri_id)) {
|
if (empty($uri_id) && !empty($item_id)) {
|
||||||
$item = Post::selectFirst(['uri-id'], ['id' => $item_id]);
|
$item = Post::selectFirst(['uri-id'], ['id' => $item_id]);
|
||||||
$uri_id = $item['uri-id'] ?? 0;
|
$uri_id = $item['uri-id'] ?? 0;
|
||||||
}
|
}
|
||||||
Post\Delivery::remove($uri_id, $inbox);
|
if (empty($uri_id)) {
|
||||||
Post\DeliveryData::incrementQueueFailed($uri_id);
|
$posts = Post\Delivery::selectForInbox($inbox);
|
||||||
|
$uri_ids = array_column($posts, 'uri-id');
|
||||||
|
} else {
|
||||||
|
$uri_ids = [$uri_id];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($uri_ids as $uri_id) {
|
||||||
|
Post\Delivery::remove($uri_id, $inbox);
|
||||||
|
Post\DeliveryData::incrementQueueFailed($uri_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue