Remove the obsolete parameter $two_way from terminateFriendship methods

- Follow revokation is now done independently
This commit is contained in:
Hypolite Petovan 2021-10-02 15:48:20 -04:00
parent 1047ad7bc2
commit c4a4473cd0
6 changed files with 18 additions and 26 deletions

View file

@ -207,12 +207,11 @@ class Protocol
*
* @param array $user User unfriending
* @param array $contact Contact unfriended
* @param boolean $two_way Revoke eventual inbound follow as well
* @return bool|null true if successful, false if not, null if no action was performed
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function terminateFriendship(array $user, array $contact, bool $two_way = false): bool
public static function terminateFriendship(array $user, array $contact): bool
{
if (empty($contact['network'])) {
throw new \InvalidArgumentException('Missing network key in contact array');
@ -243,17 +242,12 @@ class Protocol
} elseif ($protocol == Protocol::DIASPORA) {
return Diaspora::sendUnshare($user, $contact) > 0;
} elseif ($protocol == Protocol::ACTIVITYPUB) {
if ($two_way) {
ActivityPub\Transmitter::sendContactReject($contact['url'], $contact['hub-verify'], $user['uid']);
}
return ActivityPub\Transmitter::sendContactUndo($contact['url'], $contact['id'], $user['uid']);
}
// Catch-all hook for connector addons
$hook_data = [
'contact' => $contact,
'two_way' => $two_way,
'result' => null
];
Hook::callAll('unfollow', $hook_data);
@ -265,6 +259,7 @@ class Protocol
* Revoke an incoming follow from the provided contact
*
* @param array $contact Private contact (uid != 0) array
* @return bool|null true if successful, false if not, null if no action was performed
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/