- $owner = User::getOwnerDataById($uid);
- if ($owner) {
- Contact::terminateFriendship($owner, $contact, $dissolve);
- }
-
- // Sharing-only contacts get deleted as there no relationship any more
- if ($dissolve) {
- Contact::remove($contact['id']);
- $return_path = $base_return_path;
- } else {
- DBA::update('contact', ['rel' => Contact::FOLLOWER], ['id' => $contact['id']]);
- $return_path = $base_return_path . '/' . $contact['id'];
+ try {
+ Contact::unfollow($contact);
+ $notice_message = DI::l10n()->t('Contact was successfully unfollowed');
+ } catch (Exception $e) {
+ DI::logger()->error($e->getMessage(), ['contact' => $contact]);
+ $notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator');