conversation completion: stop motherless children sneaking into conversation fetches from collections

This commit is contained in:
Mike Macgirvin 2024-07-17 17:47:18 +10:00
parent 4fa7358bcc
commit 8e48997ad0
3 changed files with 7 additions and 4 deletions

View file

@ -39,7 +39,7 @@ class Convo implements DaemonInterface
$collection = new ASCollection($id, $channel);
$messages = $collection->fetchAndParse();
$messages = $collection->fetchAndParse(true);
if ($messages) {
foreach ($messages as $message) {

View file

@ -149,7 +149,7 @@ class ASCollection
logger('nextpage: ' . $this->nextpage, LOGGER_DEBUG);
}
public function fetchAndParse()
public function fetchAndParse($children_only = false)
{
$results = [];
$messages = $this->get();
@ -165,7 +165,7 @@ class ASCollection
else {
continue;
}
$fetched = Activity::fetch_and_parse($messageId, $channel);
$fetched = Activity::fetch_and_parse($messageId, $channel, $children_only);
if ($fetched) {
$results[] = $fetched;
}

View file

@ -4717,7 +4717,7 @@ class Activity
}
}
public static function fetch_and_parse($message_id, $channel)
public static function fetch_and_parse($message_id, $channel, $children_only = false)
{
if (ActivityStreams::is_url($message_id)) {
$json = self::fetch($message_id, $channel);
@ -4761,6 +4761,9 @@ class Activity
if (!$item) {
return false;
}
if ($children_only && $item['mid'] === $item['parent_mid']) {
return false;
}
$hookinfo = [
'activity' => $activity,
'item' => $item,