// Disable remote self for everything except feeds.
// There is an issue when you repeat an item from maybe twitter and you got comments from friendica and twitter
// Problem is, you couldn't reply to both networks.
- if (!in_array($contact['network'], [NETWORK_FEED, NETWORK_DFRN, NETWORK_DIASPORA])) {
+ if (!in_array($contact['network'], [NETWORK_FEED, NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_TWITTER])) {
$allow_remote_self = false;
}
/// @todo Handling of "event-id"
- $distributed = self::insert($item, false, false, true);
+ $notify = false;
+ if ($item['uri'] == $item['parent-uri']) {
+ $contact = dba::selectFirst('contact', [], ['id' => $item['contact-id'], 'self' => false]);
+ if (DBM::is_result($contact)) {
+ $notify = self::isRemoteSelf($contact, $item);
+ }
+ }
+
+ $distributed = self::insert($item, false, $notify, true);
if (!$distributed) {
logger("Distributed public item " . $itemid . " for user " . $uid . " wasn't stored", LOGGER_DEBUG);
// Prevent the forwarding of posts that are forwarded
if ($datarray["extid"] == NETWORK_DFRN) {
+ logger('Already forwarded', LOGGER_DEBUG);
return false;
}
// Prevent to forward already forwarded posts
if ($datarray["app"] == $a->get_hostname()) {
+ logger('Already forwarded (second test)', LOGGER_DEBUG);
return false;
}
// Only forward posts
if ($datarray["verb"] != ACTIVITY_POST) {
+ logger('No post', LOGGER_DEBUG);
return false;
}
if (($contact['network'] != NETWORK_FEED) && $datarray['private']) {
+ logger('Not public', LOGGER_DEBUG);
return false;
}
unset($datarray['created']);
unset($datarray['edited']);
+
+ unset($datarray['network']);
+ unset($datarray['owner-id']);
+ unset($datarray['author-id']);
}
if ($contact['network'] != NETWORK_FEED) {
unset($datarray["plink"]);
$datarray["uri"] = item_new_uri($a->get_hostname(), $contact['uid'], $datarray["guid"]);
$datarray["parent-uri"] = $datarray["uri"];
- $datarray["extid"] = $contact['network'];
+ $datarray["thr-parent"] = $datarray["uri"];
+ $datarray["extid"] = NETWORK_DFRN;
$urlpart = parse_url($datarray2['author-link']);
$datarray["app"] = $urlpart["host"];
} else {
if ($contact['network'] != NETWORK_FEED) {
// Store the original post
- $r = self::insert($datarray2, false, false);
- logger('remote-self post original item - Contact '.$contact['url'].' return '.$r.' Item '.print_r($datarray2, true), LOGGER_DEBUG);
+ $result = self::insert($datarray2, false, false);
+ logger('remote-self post original item - Contact '.$contact['url'].' return '.$result.' Item '.print_r($datarray2, true), LOGGER_DEBUG);
} else {
$datarray["app"] = "Feed";
+ $result = true;
}
// Trigger automatic reactions for addons
$_SESSION["authenticated"] = true;
$_SESSION["uid"] = $contact['uid'];
- return true;
+ return $result;
}
/**