Improvements for the "post-reason"

This commit is contained in:
Michael 2022-07-29 14:17:53 +00:00
parent a20d05ba39
commit 81aaacc67d
9 changed files with 46 additions and 43 deletions

View file

@ -1233,26 +1233,20 @@ class Transmitter
if (!$item['deleted']) {
$data = Post\Activity::getByURIId($item['uri-id']);
if (!$item['origin'] && !empty($data)) {
if (!empty($data['type'])) {
if (in_array($data['type'], ['Create', 'Update'])) {
if ($object_mode) {
unset($data['@context']);
unset($data['signature']);
}
Logger::info('Return stored conversation', ['item' => $item_id]);
return $data;
} elseif (in_array('as:' . $data['type'], Receiver::CONTENT_TYPES)) {
if (!empty($data['@context'])) {
$context = $data['@context'];
unset($data['@context']);
}
unset($data['actor']);
$object = $data;
}
if ($object_mode) {
unset($data['@context']);
unset($data['signature']);
}
Logger::info('Return stored conversation', ['item' => $item_id]);
return $data;
}
}
if (!$item['origin'] && empty($object)) {
Logger::debug('Post is not ours and is not stored', ['id' => $item_id, 'uri-id' => $item['uri-id']]);
return false;
}
$type = self::getTypeOfItem($item);
if (!$object_mode) {