]> git.mxchange.org Git - friendica-addons.git/commitdiff
[twitter] Abort follow process on API call failure
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 7 Jan 2022 11:34:28 +0000 (12:34 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 7 Jan 2022 11:34:28 +0000 (12:34 +0100)
- Prevents users without a connected Twitter account from visibly following a Twitter contact

twitter/twitter.php

index 33af5663f2b5ea107bce4b7cc785a97717cd4ddb..d9f1310aa32b5f32f608ebe3abd9626d4fb48299 100644 (file)
@@ -157,7 +157,10 @@ function twitter_follow(App $a, array &$contact)
 
        $uid = $a->getLoggedInUserId();
 
-       twitter_api_contact('friendships/create', ['network' => Protocol::TWITTER, 'nick' => $nickname], $uid);
+       if (!twitter_api_contact('friendships/create', ['network' => Protocol::TWITTER, 'nick' => $nickname], $uid)) {
+               $contact = null;
+               return;
+       }
 
        $user = twitter_fetchuser($nickname);