[twitter] Return null in the probe_detect hook result key on unsuccessful probe

- Add authoritative probe result setting
pull/1382/head
Hypolite Petovan 2023-05-04 23:32:29 -04:00
parent a0574ab045
commit f5d8604e59
1 changed files with 6 additions and 1 deletions

View File

@ -526,7 +526,12 @@ function twitter_probe_detect(array &$hookData)
$user = twitter_fetchuser($nick); $user = twitter_fetchuser($nick);
if ($user) { if ($user) {
$hookData['result'] = twitter_user_to_contact($user); $hookData['result'] = twitter_user_to_contact($user) ?: null;
}
// Authoritative probe should set the result even if the probe was unsuccessful
if ($hookData['network'] == Protocol::TWITTER && empty($hookData['result'])) {
$hookData['result'] = [];
} }
} }