Restore the behaviour to remove the remote contact upon termination

This commit is contained in:
Michael 2018-09-05 05:02:06 +00:00
parent 59d06b6c78
commit 9ef1d827f3
7 changed files with 25 additions and 16 deletions

View file

@ -17,6 +17,7 @@ use Friendica\Model\Profile;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
use Friendica\Protocol\PortableContact;
use Friendica\Protocol\Salmon;
@ -528,13 +529,16 @@ class Contact extends BaseObject
/**
* @brief Sends an unfriend message. Does not remove the contact
*
* @param array $user User unfriending
* @param array $contact Contact unfriended
* @param array $user User unfriending
* @param array $contact Contact unfriended
* @param boolean $dissolve Remove the contact on the remote side
* @return void
*/
public static function terminateFriendship(array $user, array $contact)
public static function terminateFriendship(array $user, array $contact, $dissolve = false)
{
if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DFRN])) {
if (($contact['network'] == Protocol::DFRN) && $dissolve) {
DFRN::deliver($user, $contact, 'placeholder', true);
} elseif (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DFRN])) {
// create an unfollow slap
$item = [];
$item['verb'] = NAMESPACE_OSTATUS . "/unfollow";

View file

@ -81,7 +81,8 @@ class DFRN
return [];
}
$user['importer_uid'] = $user['uid'];
$user['importer_uid'] = $user['uid'];
$user['uprvkey'] = $user['prvkey'];
} else {
$user = ['importer_uid' => 0, 'uprvkey' => '', 'timezone' => 'UTC',
'nickname' => '', 'sprvkey' => '', 'spubkey' => '',
@ -1168,10 +1169,12 @@ class DFRN
$a = get_app();
// At first try the Diaspora transport layer
$ret = self::transmit($owner, $contact, $atom);
if ($ret >= 200) {
logger('Delivery via Diaspora transport layer was successful with status ' . $ret);
return $ret;
if (!$dissolve) {
$ret = self::transmit($owner, $contact, $atom);
if ($ret >= 200) {
logger('Delivery via Diaspora transport layer was successful with status ' . $ret);
return $ret;
}
}
$idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);

View file

@ -96,7 +96,7 @@ class Notifier
return;
}
foreach ($r as $contact) {
Contact::terminateFriendship($user, $contact);
Contact::terminateFriendship($user, $contact, true);
}
return;
} elseif ($cmd == Delivery::RELOCATION) {