]> git.mxchange.org Git - friendica.git/commitdiff
Use User::getOwnerDataById in mod/unfollow
authorBenjamin Lorteau <benjamin.lorteau@cbsinteractive.com>
Fri, 31 Aug 2018 15:22:51 +0000 (11:22 -0400)
committerBenjamin Lorteau <benjamin.lorteau@cbsinteractive.com>
Fri, 31 Aug 2018 15:22:51 +0000 (11:22 -0400)
mod/unfollow.php

index 30aca5688e395a39732ef4cc937b35ce9c4a082d..0af16ec671e2bff5a4c2306b7ce986d5c1420dc5 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
+use Friendica\Model\User;
 
 function unfollow_post()
 {
@@ -45,12 +46,9 @@ function unfollow_post()
                // NOTREACHED
        }
 
-       $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);
+       $owner = User::getOwnerDataById($uid);
+       if ($owner) {
+               Contact::terminateFriendship($owner, $contact);
        }
 
        // Sharing-only contacts get deleted as there no relationship any more