]> git.mxchange.org Git - friendica.git/blobdiff - mod/unfollow.php
We can now like and dislike
[friendica.git] / mod / unfollow.php
index 0af16ec671e2bff5a4c2306b7ce986d5c1420dc5..b80263a3ecd33349047e177f8ff964547b4c56d8 100644 (file)
@@ -22,14 +22,14 @@ function unfollow_post()
                // NOTREACHED
        }
 
-       if ($_REQUEST['cancel']) {
+       if (!empty($_REQUEST['cancel'])) {
                goaway($return_url);
        }
 
        $uid = local_user();
        $url = notags(trim(defaults($_REQUEST, 'url', '')));
 
-       $condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
+       $condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
                $uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
                normalise_link($url), $url];
        $contact = DBA::selectFirst('contact', [], $condition);
@@ -46,13 +46,15 @@ function unfollow_post()
                // NOTREACHED
        }
 
+       $dissolve = ($contact['rel'] == Contact::SHARING);
+
        $owner = User::getOwnerDataById($uid);
        if ($owner) {
-               Contact::terminateFriendship($owner, $contact);
+               Contact::terminateFriendship($owner, $contact, $dissolve);
        }
 
        // Sharing-only contacts get deleted as there no relationship any more
-       if ($contact['rel'] == Contact::SHARING) {
+       if ($dissolve) {
                Contact::remove($contact['id']);
                $return_path = 'contacts';
        } else {