]> git.mxchange.org Git - friendica.git/blobdiff - mod/unfollow.php
Merge pull request #11265 from k-alin/6606-k-alin-mysql-unix-socket
[friendica.git] / mod / unfollow.php
index 0aa8a87b50865d3bc9715fe6d1d334d32a3f3704..10830bd103d29c51fb0d6f0bfb1bfa862e58bc17 100644 (file)
@@ -122,8 +122,7 @@ function unfollow_process(string $url)
 
        $owner = User::getOwnerDataById($uid);
        if (!$owner) {
-               (new \Friendica\Module\Security\Logout())->init();
-               // NOTREACHED
+               throw new \Friendica\Network\HTTPException\NotFoundException();
        }
 
        $condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
@@ -140,15 +139,10 @@ function unfollow_process(string $url)
        $return_path = $base_return_path . '/' . $contact['id'];
 
        try {
-               $result = Contact::terminateFriendship($owner, $contact);
-
-               if ($result === false) {
-                       $notice_message = DI::l10n()->t('Unable to unfollow this contact, please retry in a few minutes or contact your administrator.');
-               } else {
-                       $notice_message = DI::l10n()->t('Contact was successfully unfollowed');
-               }
+               Contact::unfollow($contact);
+               $notice_message = DI::l10n()->t('Contact was successfully unfollowed');
        } catch (Exception $e) {
-               DI::logger()->error($e->getMessage(), ['owner' => $owner, 'contact' => $contact]);
+               DI::logger()->error($e->getMessage(), ['contact' => $contact]);
                $notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator');
        }