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";