X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FProtocol.php;h=25955abd5090d21d3387e75cc02d98d00bc20bf5;hb=82972744a9cb77ca3d2f8db289e97fee2709ebd7;hp=c141bbc54e6240f2c79372050468e458ab34964c;hpb=cddead23436db38bc1cdb7a0033fb5ab14a53c6e;p=friendica.git diff --git a/src/Core/Protocol.php b/src/Core/Protocol.php index c141bbc54e..25955abd50 100644 --- a/src/Core/Protocol.php +++ b/src/Core/Protocol.php @@ -22,6 +22,7 @@ namespace Friendica\Core; use Friendica\Database\DBA; +use Friendica\Model\Item; use Friendica\Model\User; use Friendica\Network\HTTPException; use Friendica\Protocol\Activity; @@ -139,7 +140,7 @@ class Protocol // create a follow slap $item = [ 'verb' => Activity::FOLLOW, - 'gravity' => GRAVITY_ACTIVITY, + 'gravity' => Item::GRAVITY_ACTIVITY, 'follow' => $contact['url'], 'body' => '', 'title' => '', @@ -181,7 +182,8 @@ class Protocol public static function unfollow(array $contact, array $user): ?bool { if (empty($contact['network'])) { - throw new \InvalidArgumentException('Missing network key in contact array'); + Logger::notice('Contact has got no network, we quit here', ['id' => $contact['id']]); + return null; } $protocol = $contact['network']; @@ -191,18 +193,21 @@ class Protocol if (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) { // create an unfollow slap - $item = []; - $item['verb'] = Activity::O_UNFOLLOW; - $item['gravity'] = GRAVITY_ACTIVITY; - $item['follow'] = $contact['url']; - $item['body'] = ''; - $item['title'] = ''; - $item['guid'] = ''; - $item['uri-id'] = 0; + $item = [ + 'verb' => Activity::O_UNFOLLOW, + 'gravity' => Item::GRAVITY_ACTIVITY, + 'follow' => $contact['url'], + 'body' => '', + 'title' => '', + 'guid' => '', + 'uri-id' => 0, + ]; + $slap = OStatus::salmon($item, $user); if (empty($contact['notify'])) { - throw new \InvalidArgumentException('Missing expected "notify" key in OStatus/DFRN contact'); + Logger::notice('OStatus/DFRN Contact is missing notify, we quit here', ['id' => $contact['id']]); + return null; } return Salmon::slapper($user, $contact['notify'], $slap) === 0;