Use gsid for the network name

This commit is contained in:
Michael 2022-04-29 07:47:24 +00:00
parent d44641e58c
commit d3de2497bc
6 changed files with 22 additions and 7 deletions

View File

@ -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`,

View File

@ -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;
}

View File

@ -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),

View File

@ -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',

View File

@ -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'],

View File

@ -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"],