Replace remaining instances of DBA::update('contact') with Contact::update()

- This was breaking the synchronisation between the contact and user-contact tables
This commit is contained in:
Hypolite Petovan 2022-02-21 10:16:38 -05:00
parent 093dd70e79
commit 52f5d924b7
3 changed files with 4 additions and 6 deletions

View File

@ -2747,7 +2747,7 @@ class Contact
public static function removeFollower(array $contact) public static function removeFollower(array $contact)
{ {
if (in_array($contact['rel'] ?? [], [self::FRIEND, self::SHARING])) { 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'])) { } elseif (!empty($contact['id'])) {
self::remove($contact['id']); self::remove($contact['id']);
} else { } else {

View 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 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? // 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))) { //if (!$is_comment && $contact["rel"] == Contact::FOLLOWER && in_array($importer["page-flags"], array(User::PAGE_FLAGS_FREELOVE))) {
// DBA::update( // Contact::update(
// 'contact',
// array('rel' => Contact::FRIEND, 'writable' => true), // array('rel' => Contact::FRIEND, 'writable' => true),
// array('id' => $contact["id"], 'uid' => $contact["uid"]) // array('id' => $contact["id"], 'uid' => $contact["uid"])
// ); // );
@ -2123,8 +2122,7 @@ class Diaspora
private static function receiveRequestMakeFriend(array $importer, array $contact) private static function receiveRequestMakeFriend(array $importer, array $contact)
{ {
if ($contact["rel"] == Contact::SHARING) { if ($contact["rel"] == Contact::SHARING) {
DBA::update( Contact::update(
'contact',
['rel' => Contact::FRIEND, 'writable' => true], ['rel' => Contact::FRIEND, 'writable' => true],
['id' => $contact["id"], 'uid' => $importer["uid"]] ['id' => $contact["id"], 'uid' => $importer["uid"]]
); );

View File

@ -445,7 +445,7 @@ class Notifier
$condition = ['network' => Protocol::DFRN, 'uid' => $owner['uid'], 'blocked' => false, $condition = ['network' => Protocol::DFRN, 'uid' => $owner['uid'], 'blocked' => false,
'pending' => false, 'archive' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]]; '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); $conversants = array_merge($contacts, $participants);