From 5de8fe3a486704431c360100376dba67ba8cb8ff Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 30 Oct 2022 16:40:21 -0400 Subject: [PATCH] Fix unfollowing not showing on contact page - Deleted contact rows kept the relationship status which would keep showing - Deleting contact rows would also not update the corresponding user-contact record --- src/Content/Widget/VCard.php | 2 +- src/Model/Contact.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php index 13bd6f29a..9794270e2 100644 --- a/src/Content/Widget/VCard.php +++ b/src/Content/Widget/VCard.php @@ -70,7 +70,7 @@ class VCard $rel = $contact['rel']; $pending = $contact['pending']; } else { - $pcontact = Contact::selectFirst([], ['uid' => DI::userSession()->getLocalUserId(), 'uri-id' => $contact['uri-id']]); + $pcontact = Contact::selectFirst([], ['uid' => DI::userSession()->getLocalUserId(), 'uri-id' => $contact['uri-id'], 'deleted' => false]); $id = $pcontact['id'] ?? 0; $rel = $pcontact['rel'] ?? Contact::NOTHING; diff --git a/src/Model/Contact.php b/src/Model/Contact.php index b26f98520..91e89b2f2 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -902,7 +902,7 @@ class Contact self::clearFollowerFollowingEndpointCache($contact['uid']); // Archive the contact - self::update(['archive' => true, 'network' => Protocol::PHANTOM, 'deleted' => true], ['id' => $id]); + self::update(['archive' => true, 'network' => Protocol::PHANTOM, 'rel' => self::NOTHING, 'deleted' => true], ['id' => $id]); if (!DBA::exists('contact', ['uri-id' => $contact['uri-id'], 'deleted' => false])) { Avatar::deleteCache($contact);