]> git.mxchange.org Git - friendica.git/commitdiff
Ensure to store user-contact / display contact relations
authorMichael <heluecht@pirati.ca>
Mon, 29 May 2023 06:41:07 +0000 (06:41 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 29 May 2023 06:41:07 +0000 (06:41 +0000)
src/Model/Contact/User.php
src/Module/Contact/Profile.php
static/dbstructure.config.php
static/dbview.config.php

index a3091f7d836871c9a77a2c907442a4549c5afee5..8c214a5c9bbda66a8cb88f61a159957db567413c 100644 (file)
@@ -27,7 +27,6 @@ use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
-use Friendica\Database\DBStructure;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\ItemURI;
@@ -95,13 +94,14 @@ class User
 
                $update_fields = self::preparedFields($fields);
                if (!empty($update_fields)) {
-                       $contacts = DBA::select('contact', ['uri-id', 'uid'], $condition);
+                       $contacts = DBA::select('account-user-view', ['pid', 'uri-id', 'uid'], $condition);
                        while ($contact = DBA::fetch($contacts)) {
                                if (empty($contact['uri-id']) || empty($contact['uid'])) {
                                        continue;
                                }
-                               $ret = DBA::update('user-contact', $update_fields, ['uri-id' => $contact['uri-id'], 'uid' => $contact['uid']]);
-                               Logger::info('Updated user contact', ['uid' => $contact['uid'], 'uri-id' => $contact['uri-id'], 'ret' => $ret]);
+                               $update_fields['cid'] = $contact['pid'];
+                               $ret = DBA::update('user-contact', $update_fields, ['uri-id' => $contact['uri-id'], 'uid' => $contact['uid']], true);
+                               Logger::info('Updated user contact', ['uid' => $contact['uid'], 'id' => $contact['pid'], 'uri-id' => $contact['uri-id'], 'ret' => $ret]);
                        }
 
                        DBA::close($contacts);
index d80405e235b76b8c33904ad83e8d3813ec7e8672..a6aa2056f953423c28028c5425df88fcb4546373 100644 (file)
@@ -246,7 +246,7 @@ class Profile extends BaseModule
                                $relation_text = '';
                }
 
-               if (!in_array($contact['network'], array_merge(Protocol::FEDERATED, [Protocol::TWITTER]))) {
+               if (!Protocol::supportsFollow($contact['network'])) {
                        $relation_text = '';
                }
 
index ffb66d9701343eff98462e73aa28b55333bdf3a6..43dcd5ed294eda85a16519bb283d89314cef1b62 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1518);
+       define('DB_UPDATE_VERSION', 1519);
 }
 
 return [
index 5e38acfd6c66a7ac334b17e0880cae7f6c8d2113..b960cfaf3d8cc280edae015df7af3b2e64b73b76 100644 (file)
                        "parent-author-network" => ["parent-post-author", "network"],
                ],
                "query" => "FROM `post-user`
-                       STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
+                       INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
                        STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
                        STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
                        STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
                        "contact-type" => ["ownercontact", "contact-type"],
                ],
                "query" => "FROM `post-user`
-                       STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`                  
+                       INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`                     
                        INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
                        LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
                        LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`