X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Funfollow.php;h=10830bd103d29c51fb0d6f0bfb1bfa862e58bc17;hb=e00c12f09d51bfb16c9b08307f2f61ded9ba9777;hp=2dc9180dc940084ec7f558d90e1bbf8b24d32205;hpb=810699b454067f7849286bd63346df9f2d659e78;p=friendica.git diff --git a/mod/unfollow.php b/mod/unfollow.php index 2dc9180dc9..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,25 +136,13 @@ function unfollow_process(string $url) // NOTREACHED } - $notice_message = ''; $return_path = $base_return_path . '/' . $contact['id']; try { - $result = Contact::terminateFriendship($owner, $contact); - - 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]); + DI::logger()->error($e->getMessage(), ['contact' => $contact]); $notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator'); }