diff --git a/database.sql b/database.sql index 9952f8c3d..785b0f7b5 100644 --- a/database.sql +++ b/database.sql @@ -1720,6 +1720,7 @@ CREATE VIEW `post-user-view` AS SELECT `author`.`blocked` AS `author-blocked`, `author`.`hidden` AS `author-hidden`, `author`.`updated` AS `author-updated`, + `author`.`gsid` AS `author-gsid`, `post-user`.`owner-id` AS `owner-id`, `owner`.`url` AS `owner-link`, `owner`.`addr` AS `owner-addr`, @@ -1887,6 +1888,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT `author`.`blocked` AS `author-blocked`, `author`.`hidden` AS `author-hidden`, `author`.`updated` AS `author-updated`, + `author`.`gsid` AS `author-gsid`, `post-thread-user`.`owner-id` AS `owner-id`, `owner`.`url` AS `owner-link`, `owner`.`addr` AS `owner-addr`, @@ -2040,6 +2042,7 @@ CREATE VIEW `post-view` AS SELECT `author`.`blocked` AS `author-blocked`, `author`.`hidden` AS `author-hidden`, `author`.`updated` AS `author-updated`, + `author`.`gsid` AS `author-gsid`, `post`.`owner-id` AS `owner-id`, `owner`.`url` AS `owner-link`, `owner`.`addr` AS `owner-addr`, @@ -2169,6 +2172,7 @@ CREATE VIEW `post-thread-view` AS SELECT `author`.`blocked` AS `author-blocked`, `author`.`hidden` AS `author-hidden`, `author`.`updated` AS `author-updated`, + `author`.`gsid` AS `author-gsid`, `post-thread`.`owner-id` AS `owner-id`, `owner`.`url` AS `owner-link`, `owner`.`addr` AS `owner-addr`, diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 9035d37e7..6c7e09945 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -184,7 +184,7 @@ class ContactSelector * @return string * @throws \Exception */ - public static function networkToIcon($network, $profile = "") + public static function networkToIcon($network, $profile = "", $gsid = 0) { $nets = [ Protocol::DFRN => 'friendica', @@ -218,7 +218,14 @@ class ContactSelector $network_icon = str_replace($search, $replace, $network); if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) { - $gserver = self::getServerForProfile($profile); + if (!empty($gsid) && !empty(self::$serverdata[$gsid])) { + $gserver = self::$serverdata[$gsid]; + } elseif (!empty($gsid)) { + $gserver = DBA::selectFirst('gserver', ['platform', 'network'], ['id' => $gsid]); + self::$serverdata[$gsid] = $gserver; + } else { + $gserver = self::getServerForProfile($profile); + } if (!empty($gserver['platform'])) { $network_icon = $platform_icons[strtolower($gserver['platform'])] ?? $network_icon; } diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index fd880a045..48695b219 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -678,8 +678,8 @@ class Conversation 'created_date' => $item['created'], 'uriid' => $item['uri-id'], 'network' => $item['network'], - 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network']), - 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link']), + 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network'], $item['author-gsid']), + 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link'], $item['author-gsid']), 'linktitle' => $this->l10n->t('View %s\'s profile @ %s', $profile_name, $item['author-link']), 'profile_url' => $profile_link, 'item_photo_menu_html' => $this->item->photoMenu($item, $formSecurityToken), diff --git a/src/Model/Item.php b/src/Model/Item.php index 3900c557c..84fa0af11 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -87,7 +87,7 @@ class Item 'wall', 'private', 'starred', 'origin', 'parent-origin', 'title', 'body', 'language', 'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'mention', 'global', - 'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network', 'author-updated', + 'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network', 'author-updated', 'author-gsid', 'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type', 'owner-updated', 'causer-id', 'causer-link', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network', 'contact-id', 'contact-uid', 'contact-link', 'contact-name', 'contact-avatar', diff --git a/src/Object/Post.php b/src/Object/Post.php index 7f5adde0a..a949c24aa 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -538,8 +538,8 @@ class Post 'thread_level' => $thread_level, 'edited' => $edited, 'network' => $item["network"], - 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network']), - 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link']), + 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network'], $item['author-gsid']), + 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link'], $item['author-gsid']), 'received' => $item['received'], 'commented' => $item['commented'], 'created_date' => $item['created'], diff --git a/static/dbview.config.php b/static/dbview.config.php index 3faec770f..a623e4636 100644 --- a/static/dbview.config.php +++ b/static/dbview.config.php @@ -147,6 +147,7 @@ "author-blocked" => ["author", "blocked"], "author-hidden" => ["author", "hidden"], "author-updated" => ["author", "updated"], + "author-gsid" => ["author", "gsid"], "owner-id" => ["post-user", "owner-id"], "owner-link" => ["owner", "url"], "owner-addr" => ["owner", "addr"], @@ -312,6 +313,7 @@ "author-blocked" => ["author", "blocked"], "author-hidden" => ["author", "hidden"], "author-updated" => ["author", "updated"], + "author-gsid" => ["author", "gsid"], "owner-id" => ["post-thread-user", "owner-id"], "owner-link" => ["owner", "url"], "owner-addr" => ["owner", "addr"], @@ -463,6 +465,7 @@ "author-blocked" => ["author", "blocked"], "author-hidden" => ["author", "hidden"], "author-updated" => ["author", "updated"], + "author-gsid" => ["author", "gsid"], "owner-id" => ["post", "owner-id"], "owner-link" => ["owner", "url"], "owner-addr" => ["owner", "addr"], @@ -590,6 +593,7 @@ "author-blocked" => ["author", "blocked"], "author-hidden" => ["author", "hidden"], "author-updated" => ["author", "updated"], + "author-gsid" => ["author", "gsid"], "owner-id" => ["post-thread", "owner-id"], "owner-link" => ["owner", "url"], "owner-addr" => ["owner", "addr"],