X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FConsole%2FContact.php;h=f051d870a295c8710a72f21a7b7c57992fc3f486;hb=7d958e8804f5fabc9b748c68c7b8f55d8885360c;hp=ba65c0025176545136733cfd3eff892adbbc170d;hpb=4495e83eca67986ecbd5e083509c782116d77c6c;p=friendica.git diff --git a/src/Console/Contact.php b/src/Console/Contact.php index ba65c00251..f051d870a2 100644 --- a/src/Console/Contact.php +++ b/src/Console/Contact.php @@ -1,6 +1,6 @@ getArgument(1); if (empty($cid)) { @@ -194,15 +199,24 @@ HELP; throw new RuntimeException('Contact not found'); } - $user = UserModel::getById($contact['uid']); + if (empty($contact['uid'])) { + throw new RuntimeException('Contact must be user-specific (uid != 0)'); + } + + try { + ContactModel::unfollow($contact); + + $this->out('Contact was successfully unfollowed'); - $result = ContactModel::terminateFriendship($user, $contact); + return true; + } catch (\Exception $e) { + DI::logger()->error($e->getMessage(), ['contact' => $contact]); + throw new RuntimeException('Unable to unfollow this contact, please check the log'); + } } /** * Marks a contact for removal - * - * @return bool True, if the command was successful */ private function removeContact() { @@ -215,7 +229,7 @@ HELP; } } - $result = ContactModel::remove($cid); + ContactModel::remove($cid); } /**