Restore the behaviour to remove the remote contact upon termination
This commit is contained in:
parent
59d06b6c78
commit
9ef1d827f3
7 changed files with 25 additions and 16 deletions
|
@ -368,7 +368,7 @@ function _contact_drop($orig_record)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Contact::terminateFriendship($r[0], $orig_record);
|
Contact::terminateFriendship($r[0], $orig_record, true);
|
||||||
Contact::remove($orig_record['id']);
|
Contact::remove($orig_record['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,8 +322,8 @@ function dfrn_notify_content(App $a) {
|
||||||
$encrypted_id = '';
|
$encrypted_id = '';
|
||||||
$id_str = $my_id . '.' . mt_rand(1000,9999);
|
$id_str = $my_id . '.' . mt_rand(1000,9999);
|
||||||
|
|
||||||
$prv_key = trim($importer['prvkey']);
|
$prv_key = trim($importer['cprvkey']);
|
||||||
$pub_key = trim($importer['pubkey']);
|
$pub_key = trim($importer['cpubkey']);
|
||||||
$dplx = intval($importer['duplex']);
|
$dplx = intval($importer['duplex']);
|
||||||
|
|
||||||
if (($dplx && strlen($prv_key)) || (strlen($prv_key) && !strlen($pub_key))) {
|
if (($dplx && strlen($prv_key)) || (strlen($prv_key) && !strlen($pub_key))) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
|
|
||||||
$local = Config::get('system','poco_local_search');
|
$local = Config::get('system','poco_local_search');
|
||||||
|
|
||||||
$search = $prefix.notags(trim($_REQUEST['search']));
|
$search = $prefix.notags(trim(defaults($_REQUEST, 'search', '')));
|
||||||
|
|
||||||
$header = '';
|
$header = '';
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,15 @@ function unfollow_post()
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dissolve = ($contact['rel'] == Contact::SHARING);
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
$owner = User::getOwnerDataById($uid);
|
||||||
if ($owner) {
|
if ($owner) {
|
||||||
Contact::terminateFriendship($owner, $contact);
|
Contact::terminateFriendship($owner, $contact, $dissolve);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sharing-only contacts get deleted as there no relationship any more
|
// Sharing-only contacts get deleted as there no relationship any more
|
||||||
if ($contact['rel'] == Contact::SHARING) {
|
if ($dissolve) {
|
||||||
Contact::remove($contact['id']);
|
Contact::remove($contact['id']);
|
||||||
$return_path = 'contacts';
|
$return_path = 'contacts';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -17,6 +17,7 @@ use Friendica\Model\Profile;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use Friendica\Protocol\Salmon;
|
use Friendica\Protocol\Salmon;
|
||||||
|
@ -528,13 +529,16 @@ class Contact extends BaseObject
|
||||||
/**
|
/**
|
||||||
* @brief Sends an unfriend message. Does not remove the contact
|
* @brief Sends an unfriend message. Does not remove the contact
|
||||||
*
|
*
|
||||||
* @param array $user User unfriending
|
* @param array $user User unfriending
|
||||||
* @param array $contact Contact unfriended
|
* @param array $contact Contact unfriended
|
||||||
|
* @param boolean $dissolve Remove the contact on the remote side
|
||||||
* @return void
|
* @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
|
// create an unfollow slap
|
||||||
$item = [];
|
$item = [];
|
||||||
$item['verb'] = NAMESPACE_OSTATUS . "/unfollow";
|
$item['verb'] = NAMESPACE_OSTATUS . "/unfollow";
|
||||||
|
|
|
@ -81,7 +81,8 @@ class DFRN
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$user['importer_uid'] = $user['uid'];
|
$user['importer_uid'] = $user['uid'];
|
||||||
|
$user['uprvkey'] = $user['prvkey'];
|
||||||
} else {
|
} else {
|
||||||
$user = ['importer_uid' => 0, 'uprvkey' => '', 'timezone' => 'UTC',
|
$user = ['importer_uid' => 0, 'uprvkey' => '', 'timezone' => 'UTC',
|
||||||
'nickname' => '', 'sprvkey' => '', 'spubkey' => '',
|
'nickname' => '', 'sprvkey' => '', 'spubkey' => '',
|
||||||
|
@ -1168,10 +1169,12 @@ class DFRN
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
// At first try the Diaspora transport layer
|
// At first try the Diaspora transport layer
|
||||||
$ret = self::transmit($owner, $contact, $atom);
|
if (!$dissolve) {
|
||||||
if ($ret >= 200) {
|
$ret = self::transmit($owner, $contact, $atom);
|
||||||
logger('Delivery via Diaspora transport layer was successful with status ' . $ret);
|
if ($ret >= 200) {
|
||||||
return $ret;
|
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']);
|
$idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Notifier
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach ($r as $contact) {
|
foreach ($r as $contact) {
|
||||||
Contact::terminateFriendship($user, $contact);
|
Contact::terminateFriendship($user, $contact, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} elseif ($cmd == Delivery::RELOCATION) {
|
} elseif ($cmd == Delivery::RELOCATION) {
|
||||||
|
|
Loading…
Reference in a new issue