X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Funfollow.php;h=10830bd103d29c51fb0d6f0bfb1bfa862e58bc17;hb=e00c12f09d51bfb16c9b08307f2f61ded9ba9777;hp=a307c4d6e683594d3fd61ec4a97502816276bd1a;hpb=8dc4499bcfe0adef3a3a4ff77abfe0c5588a3409;p=friendica.git diff --git a/mod/unfollow.php b/mod/unfollow.php index a307c4d6e6..10830bd103 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -1,6 +1,6 @@ t('Unfollowing is currently not supported by your network.')); DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']); // NOTREACHED @@ -122,8 +122,7 @@ function unfollow_process(string $url) $owner = User::getOwnerDataById($uid); if (!$owner) { - \Friendica\Module\Security\Logout::init(); - // NOTREACHED + throw new \Friendica\Network\HTTPException\NotFoundException(); } $condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)", @@ -137,27 +136,13 @@ function unfollow_process(string $url) // NOTREACHED } - $dissolve = ($contact['rel'] == Contact::SHARING); - - $notice_message = ''; $return_path = $base_return_path . '/' . $contact['id']; try { - $result = Contact::terminateFriendship($owner, $contact, $dissolve); - - if ($result === null) { - $notice_message = DI::l10n()->t('Unfollowing is currently not supported by this contact\'s network.'); - } - - if ($result === false) { - $notice_message = DI::l10n()->t('Unable to unfollow this contact, please retry in a few minutes or contact your administrator.'); - } - - if ($result === true) { - $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, 'dissolve' => $dissolve]); + DI::logger()->error($e->getMessage(), ['contact' => $contact]); $notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator'); }