unset($item['mention']);
unset($item['wall']);
unset($item['origin']);
- unset($item['global']);
unset($item['starred']);
unset($item['rendered-hash']);
unset($item['rendered-html']);
if (!dba::exists('item', ['uri' => $item['uri'], 'uid' => 0])) {
// Preparing public shadow (removing user specific data)
- unset($item['id']);
$item['uid'] = 0;
- $item['origin'] = 0;
- $item['wall'] = 0;
+ unset($item['id']);
+ unset($item['parent']);
+ unset($item['wall']);
+ unset($item['mention']);
+ unset($item['origin']);
+ unset($item['starred']);
+ unset($item['rendered-hash']);
+ unset($item['rendered-html']);
if ($item['uri'] == $item['parent-uri']) {
$item['contact-id'] = Contact::getIdForURL($item['owner-link']);
} else {
return;
}
+ // Save "origin" and "parent" state
+ $origin = $item['origin'];
+ $parent = $item['parent'];
+
// Preparing public shadow (removing user specific data)
- unset($item['id']);
$item['uid'] = 0;
- $item['origin'] = 0;
- $item['wall'] = 0;
+ unset($item['id']);
+ unset($item['parent']);
+ unset($item['wall']);
+ unset($item['mention']);
+ unset($item['origin']);
+ unset($item['starred']);
+ unset($item['rendered-hash']);
+ unset($item['rendered-html']);
$item['contact-id'] = Contact::getIdForURL($item['author-link']);
if (in_array($item['type'], ["net-comment", "wall-comment"])) {
$public_shadow = self::insert($item, false, false, true);
logger("Stored public shadow for comment ".$item['uri']." under id ".$public_shadow, LOGGER_DEBUG);
+
+ // If this was a comment to a Diaspora post we don't get our comment back.
+ // This means that we have to distribute the comment by ourselves.
+ if ($origin) {
+ if (dba::exists('item', ['id' => $parent, 'network' => NETWORK_DIASPORA])) {
+ self::distribute($public_shadow);
+ }
+ }
}
/**