]> git.mxchange.org Git - friendica.git/commitdiff
Prevent unfollowing contacts from networks not supported natively
authorHypolite Petovan <mrpetovan@gmail.com>
Thu, 30 Aug 2018 21:53:23 +0000 (17:53 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Thu, 30 Aug 2018 21:53:23 +0000 (17:53 -0400)
mod/unfollow.php

index f82796a6b793fb2e52140ec6cf6965d5a3c9a9c7..30aca5688e395a39732ef4cc937b35ce9c4a082d 100644 (file)
@@ -39,20 +39,18 @@ function unfollow_post()
                // NOTREACHED
        }
 
-       if ($contact['network'] == Protocol::STATUSNET) {
+       if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
                notice(L10n::t('Unfollowing is currently not supported by your network.'));
                goaway($return_url);
                // NOTREACHED
        }
 
-       if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN])) {
-               $r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
-                       WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
-                       intval($uid)
-               );
-               if (DBA::isResult($r)) {
-                       Contact::terminateFriendship($r[0], $contact);
-               }
+       $r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
+               WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
+               intval($uid)
+       );
+       if (DBA::isResult($r)) {
+               Contact::terminateFriendship($r[0], $contact);
        }
 
        // Sharing-only contacts get deleted as there no relationship any more
@@ -92,7 +90,7 @@ function unfollow_content(App $a)
                // NOTREACHED
        }
 
-       if ($contact['network'] == Protocol::STATUSNET) {
+       if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
                notice(L10n::t('Unfollowing is currently not supported by your network.'));
                goaway('contacts/' . $contact['id']);
                // NOTREACHED