]> git.mxchange.org Git - friendica-addons.git/commitdiff
[twitter] Return null in the probe_detect hook result key on unsuccessful probe
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 5 May 2023 03:32:29 +0000 (23:32 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 5 May 2023 04:08:17 +0000 (00:08 -0400)
- Add authoritative probe result setting

twitter/twitter.php

index c55489a00836c9aeeb58e0f29d56e519aae6f9e5..aaa378d18098f618693bbe0f8b27eabbe7979586 100644 (file)
@@ -526,7 +526,12 @@ function twitter_probe_detect(array &$hookData)
        $user = twitter_fetchuser($nick);
 
        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'] = [];
        }
 }