mirror of
https://github.com/friendica/friendica
synced 2025-04-26 11:50:11 +00:00
ActivityPub: Delete Comments
This commit is contained in:
parent
a4f7fddf41
commit
5bbcb8bdf4
4 changed files with 37 additions and 30 deletions
|
@ -1069,25 +1069,27 @@ class Transmitter
|
|||
return false;
|
||||
}
|
||||
|
||||
$condition = ['item-uri' => $item['uri'], 'protocol' => Conversation::PARCEL_ACTIVITYPUB];
|
||||
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
|
||||
if (!$item['origin'] && DBA::isResult($conversation)) {
|
||||
$data = json_decode($conversation['source'], true);
|
||||
if (!empty($data['type'])) {
|
||||
if (in_array($data['type'], ['Create', 'Update'])) {
|
||||
if ($object_mode) {
|
||||
unset($data['@context']);
|
||||
unset($data['signature']);
|
||||
if (!$item['deleted']) {
|
||||
$condition = ['item-uri' => $item['uri'], 'protocol' => Conversation::PARCEL_ACTIVITYPUB];
|
||||
$conversation = DBA::selectFirst('conversation', ['source'], $condition);
|
||||
if (!$item['origin'] && DBA::isResult($conversation)) {
|
||||
$data = json_decode($conversation['source'], true);
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1106,7 +1108,9 @@ class Transmitter
|
|||
$data = [];
|
||||
}
|
||||
|
||||
if (($item['gravity'] == GRAVITY_ACTIVITY) && ($type != 'Undo')) {
|
||||
if ($type == 'Delete') {
|
||||
$data['id'] = Item::newURI($item['uid'], $item['guid']) . '/' . $type;;
|
||||
} elseif (($item['gravity'] == GRAVITY_ACTIVITY) && ($type != 'Undo')) {
|
||||
$data['id'] = $item['uri'];
|
||||
} else {
|
||||
$data['id'] = $item['uri'] . '/' . $type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue