Merge pull request #12255 from annando/invalid-unfollow

Silently quit on unfollow of invalid contacts
This commit is contained in:
Hypolite Petovan 2022-11-24 14:46:59 -05:00 committed by GitHub
commit 313f3d8515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -182,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'];
@ -205,7 +206,8 @@ class Protocol
$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;