]> git.mxchange.org Git - friendica.git/commitdiff
Replace remaining instances of DBA::update('contact') with Contact::update()
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Feb 2022 15:16:38 +0000 (10:16 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 24 Feb 2022 14:35:54 +0000 (09:35 -0500)
- This was breaking the synchronisation between the contact and user-contact tables

src/Model/Contact.php
src/Protocol/Diaspora.php
src/Worker/Notifier.php

index d80827c93f9e60c61467d284267c1d57ea4630b2..9b0020d009bd2209c12325d6ac5014ea0c303c61 100644 (file)
@@ -2747,7 +2747,7 @@ class Contact
        public static function removeFollower(array $contact)
        {
                if (in_array($contact['rel'] ?? [], [self::FRIEND, self::SHARING])) {
-                       DBA::update('contact', ['rel' => self::SHARING], ['id' => $contact['id']]);
+                       self::update(['rel' => self::SHARING], ['id' => $contact['id']]);
                } elseif (!empty($contact['id'])) {
                        self::remove($contact['id']);
                } else {
index ea0b2b6749ab9a6b83c2749a5ad26e0c6335c156..ad8e2bbef8d28d5c983ba9f2001c831e736e71cd 100644 (file)
@@ -837,8 +837,7 @@ class Diaspora
                // It is deactivated by now, due to side effects. See issue https://github.com/friendica/friendica/pull/4033
                // It is not removed by now. Possibly the code is needed?
                //if (!$is_comment && $contact["rel"] == Contact::FOLLOWER && in_array($importer["page-flags"], array(User::PAGE_FLAGS_FREELOVE))) {
-               //      DBA::update(
-               //              'contact',
+               //      Contact::update(
                //              array('rel' => Contact::FRIEND, 'writable' => true),
                //              array('id' => $contact["id"], 'uid' => $contact["uid"])
                //      );
@@ -2123,8 +2122,7 @@ class Diaspora
        private static function receiveRequestMakeFriend(array $importer, array $contact)
        {
                if ($contact["rel"] == Contact::SHARING) {
-                       DBA::update(
-                               'contact',
+                       Contact::update(
                                ['rel' => Contact::FRIEND, 'writable' => true],
                                ['id' => $contact["id"], 'uid' => $importer["uid"]]
                        );
index 488ade22297d9e84c18781b3f13b821f3e5d7fab..e570b13fe1ab6e64ef867d73e0b4378649e3a673 100644 (file)
@@ -445,7 +445,7 @@ class Notifier
                        $condition = ['network' => Protocol::DFRN, 'uid' => $owner['uid'], 'blocked' => false,
                                'pending' => false, 'archive' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]];
 
-                       $contacts = DBA::toArray(DBA::select('contact', ['id', 'url', 'addr', 'name', 'network', 'protocol'], $condition));
+                       $contacts = DBA::selectToArray('contact', ['id', 'url', 'addr', 'name', 'network', 'protocol'], $condition);
 
                        $conversants = array_merge($contacts, $participants);