"remote-self" is now working for Diaspora and Twitter as well
This commit is contained in:
parent
e5a6e7b449
commit
1230ff146a
3 changed files with 28 additions and 6 deletions
|
@ -121,7 +121,7 @@ function crepair_content(App $a)
|
|||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -925,7 +925,15 @@ class Item extends BaseObject
|
|||
|
||||
/// @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);
|
||||
|
@ -1406,20 +1414,24 @@ class Item extends BaseObject
|
|||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -1441,6 +1453,10 @@ class Item extends BaseObject
|
|||
|
||||
unset($datarray['created']);
|
||||
unset($datarray['edited']);
|
||||
|
||||
unset($datarray['network']);
|
||||
unset($datarray['owner-id']);
|
||||
unset($datarray['author-id']);
|
||||
}
|
||||
|
||||
if ($contact['network'] != NETWORK_FEED) {
|
||||
|
@ -1448,7 +1464,8 @@ class Item extends BaseObject
|
|||
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 {
|
||||
|
@ -1458,10 +1475,11 @@ class Item extends BaseObject
|
|||
|
||||
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
|
||||
|
@ -1471,7 +1489,7 @@ class Item extends BaseObject
|
|||
$_SESSION["authenticated"] = true;
|
||||
$_SESSION["uid"] = $contact['uid'];
|
||||
|
||||
return true;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2767,6 +2767,10 @@ class DFRN
|
|||
|
||||
$posted_id = Item::insert($item, false, $notify);
|
||||
|
||||
if ($notify) {
|
||||
$notify = $notify;
|
||||
}
|
||||
|
||||
logger("Item was stored with id ".$posted_id, LOGGER_DEBUG);
|
||||
|
||||
if ($item['uid'] == 0) {
|
||||
|
|
Loading…
Reference in a new issue