Fetch avatar by id
This commit is contained in:
parent
1326239576
commit
d44641e58c
7 changed files with 45 additions and 9 deletions
10
database.sql
10
database.sql
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 2022.05-dev (Siberian Iris)
|
||||
-- DB_UPDATE_VERSION 1460
|
||||
-- DB_UPDATE_VERSION 1461
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -1719,6 +1719,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
`author`.`network` AS `author-network`,
|
||||
`author`.`blocked` AS `author-blocked`,
|
||||
`author`.`hidden` AS `author-hidden`,
|
||||
`author`.`updated` AS `author-updated`,
|
||||
`post-user`.`owner-id` AS `owner-id`,
|
||||
`owner`.`url` AS `owner-link`,
|
||||
`owner`.`addr` AS `owner-addr`,
|
||||
|
@ -1728,6 +1729,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
`owner`.`network` AS `owner-network`,
|
||||
`owner`.`blocked` AS `owner-blocked`,
|
||||
`owner`.`hidden` AS `owner-hidden`,
|
||||
`owner`.`updated` AS `owner-updated`,
|
||||
`owner`.`contact-type` AS `owner-contact-type`,
|
||||
`post-user`.`causer-id` AS `causer-id`,
|
||||
`causer`.`url` AS `causer-link`,
|
||||
|
@ -1884,6 +1886,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
`author`.`network` AS `author-network`,
|
||||
`author`.`blocked` AS `author-blocked`,
|
||||
`author`.`hidden` AS `author-hidden`,
|
||||
`author`.`updated` AS `author-updated`,
|
||||
`post-thread-user`.`owner-id` AS `owner-id`,
|
||||
`owner`.`url` AS `owner-link`,
|
||||
`owner`.`addr` AS `owner-addr`,
|
||||
|
@ -1893,6 +1896,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
`owner`.`network` AS `owner-network`,
|
||||
`owner`.`blocked` AS `owner-blocked`,
|
||||
`owner`.`hidden` AS `owner-hidden`,
|
||||
`owner`.`updated` AS `owner-updated`,
|
||||
`owner`.`contact-type` AS `owner-contact-type`,
|
||||
`post-thread-user`.`causer-id` AS `causer-id`,
|
||||
`causer`.`url` AS `causer-link`,
|
||||
|
@ -2035,6 +2039,7 @@ CREATE VIEW `post-view` AS SELECT
|
|||
`author`.`network` AS `author-network`,
|
||||
`author`.`blocked` AS `author-blocked`,
|
||||
`author`.`hidden` AS `author-hidden`,
|
||||
`author`.`updated` AS `author-updated`,
|
||||
`post`.`owner-id` AS `owner-id`,
|
||||
`owner`.`url` AS `owner-link`,
|
||||
`owner`.`addr` AS `owner-addr`,
|
||||
|
@ -2044,6 +2049,7 @@ CREATE VIEW `post-view` AS SELECT
|
|||
`owner`.`network` AS `owner-network`,
|
||||
`owner`.`blocked` AS `owner-blocked`,
|
||||
`owner`.`hidden` AS `owner-hidden`,
|
||||
`owner`.`updated` AS `owner-updated`,
|
||||
`owner`.`contact-type` AS `owner-contact-type`,
|
||||
`post`.`causer-id` AS `causer-id`,
|
||||
`causer`.`url` AS `causer-link`,
|
||||
|
@ -2162,6 +2168,7 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
`author`.`network` AS `author-network`,
|
||||
`author`.`blocked` AS `author-blocked`,
|
||||
`author`.`hidden` AS `author-hidden`,
|
||||
`author`.`updated` AS `author-updated`,
|
||||
`post-thread`.`owner-id` AS `owner-id`,
|
||||
`owner`.`url` AS `owner-link`,
|
||||
`owner`.`addr` AS `owner-addr`,
|
||||
|
@ -2171,6 +2178,7 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
`owner`.`network` AS `owner-network`,
|
||||
`owner`.`blocked` AS `owner-blocked`,
|
||||
`owner`.`hidden` AS `owner-hidden`,
|
||||
`owner`.`updated` AS `owner-updated`,
|
||||
`owner`.`contact-type` AS `owner-contact-type`,
|
||||
`post-thread`.`causer-id` AS `causer-id`,
|
||||
`causer`.`url` AS `causer-link`,
|
||||
|
|
|
@ -659,6 +659,16 @@ class Conversation
|
|||
$pinned = '';
|
||||
}
|
||||
|
||||
if (in_array($item['network'], [Protocol::FEED, Protocol::MAIL])) {
|
||||
$owner_avatar = $author_avatar = $item['contact-id'];
|
||||
$owner_updated = $author_updated = '';
|
||||
} else {
|
||||
$owner_avatar = $item['owner-id'];
|
||||
$owner_updated = $item['owner-updated'];
|
||||
$author_avatar = $item['author-id'];
|
||||
$author_updated = $item['author-updated'];
|
||||
}
|
||||
|
||||
$tmp_item = [
|
||||
'template' => $tpl,
|
||||
'id' => ($preview ? 'P0' : $item['id']),
|
||||
|
@ -676,7 +686,7 @@ class Conversation
|
|||
'name' => $profile_name,
|
||||
'sparkle' => $sparkle,
|
||||
'lock' => false,
|
||||
'thumb' => $this->baseURL->remove(Contact::getAvatarUrlForUrl($item['author-link'], $item['uid'], Proxy::SIZE_THUMB)),
|
||||
'thumb' => $this->baseURL->remove(Contact::getAvatarUrlForId($author_avatar, Proxy::SIZE_THUMB, $author_updated)),
|
||||
'title' => $title,
|
||||
'body_html' => $body_html,
|
||||
'tags' => $tags['tags'],
|
||||
|
@ -697,7 +707,7 @@ class Conversation
|
|||
'indent' => '',
|
||||
'owner_name' => '',
|
||||
'owner_url' => '',
|
||||
'owner_photo' => $this->baseURL->remove(Contact::getAvatarUrlForUrl($item['owner-link'], $item['uid'], Proxy::SIZE_THUMB)),
|
||||
'owner_photo' => $this->baseURL->remove(Contact::getAvatarUrlForId($owner_avatar, Proxy::SIZE_THUMB, $owner_updated)),
|
||||
'plink' => ItemModel::getPlink($item),
|
||||
'edpost' => false,
|
||||
'pinned' => $pinned,
|
||||
|
|
|
@ -1799,7 +1799,7 @@ class Contact
|
|||
{
|
||||
// We have to fetch the "updated" variable when it wasn't provided
|
||||
// The parameter can be provided to improve performance
|
||||
if (empty($updated) || empty($guid)) {
|
||||
if (empty($updated)) {
|
||||
$account = DBA::selectFirst('account-user-view', ['updated', 'guid'], ['id' => $cid]);
|
||||
$updated = $account['updated'] ?? '';
|
||||
$guid = $account['guid'] ?? '';
|
||||
|
|
|
@ -87,8 +87,8 @@ 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',
|
||||
'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type',
|
||||
'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network', 'author-updated',
|
||||
'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',
|
||||
'writable', 'self', 'cid', 'alias',
|
||||
|
|
|
@ -450,6 +450,16 @@ class Post
|
|||
$browsershare = null;
|
||||
}
|
||||
|
||||
if (in_array($item['network'], [Protocol::FEED, Protocol::MAIL])) {
|
||||
$owner_avatar = $author_avatar = $item['contact-id'];
|
||||
$owner_updated = $author_updated = '';
|
||||
} else {
|
||||
$owner_avatar = $item['owner-id'];
|
||||
$owner_updated = $item['owner-updated'];
|
||||
$author_avatar = $item['author-id'];
|
||||
$author_updated = $item['author-updated'];
|
||||
}
|
||||
|
||||
$tmp_item = [
|
||||
'template' => $this->getTemplate(),
|
||||
'type' => implode("", array_slice(explode("/", $item['verb']), -1)),
|
||||
|
@ -481,7 +491,7 @@ class Post
|
|||
'profile_url' => $profile_link,
|
||||
'name' => $profile_name,
|
||||
'item_photo_menu_html' => DI::contentItem()->photoMenu($item, $formSecurityToken),
|
||||
'thumb' => DI::baseUrl()->remove(Contact::getAvatarUrlForUrl($item['author-link'], $item['uid'], Proxy::SIZE_THUMB)),
|
||||
'thumb' => DI::baseUrl()->remove(Contact::getAvatarUrlForId($author_avatar, Proxy::SIZE_THUMB, $author_updated)),
|
||||
'osparkle' => $osparkle,
|
||||
'sparkle' => $sparkle,
|
||||
'title' => $title,
|
||||
|
@ -498,7 +508,7 @@ class Post
|
|||
'shiny' => $shiny,
|
||||
'owner_self' => $item['author-link'] == Session::get('my_url'),
|
||||
'owner_url' => $this->getOwnerUrl(),
|
||||
'owner_photo' => DI::baseUrl()->remove(Contact::getAvatarUrlForUrl($item['owner-link'], $item['uid'], Proxy::SIZE_THUMB)),
|
||||
'owner_photo' => DI::baseUrl()->remove(Contact::getAvatarUrlForId($owner_avatar, Proxy::SIZE_THUMB, $owner_updated)),
|
||||
'owner_name' => $this->getOwnerName(),
|
||||
'plink' => Item::getPlink($item),
|
||||
'browsershare' => $browsershare,
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
use Friendica\Database\DBA;
|
||||
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1460);
|
||||
define('DB_UPDATE_VERSION', 1461);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -146,6 +146,7 @@
|
|||
"author-network" => ["author", "network"],
|
||||
"author-blocked" => ["author", "blocked"],
|
||||
"author-hidden" => ["author", "hidden"],
|
||||
"author-updated" => ["author", "updated"],
|
||||
"owner-id" => ["post-user", "owner-id"],
|
||||
"owner-link" => ["owner", "url"],
|
||||
"owner-addr" => ["owner", "addr"],
|
||||
|
@ -155,6 +156,7 @@
|
|||
"owner-network" => ["owner", "network"],
|
||||
"owner-blocked" => ["owner", "blocked"],
|
||||
"owner-hidden" => ["owner", "hidden"],
|
||||
"owner-updated" => ["owner", "updated"],
|
||||
"owner-contact-type" => ["owner", "contact-type"],
|
||||
"causer-id" => ["post-user", "causer-id"],
|
||||
"causer-link" => ["causer", "url"],
|
||||
|
@ -309,6 +311,7 @@
|
|||
"author-network" => ["author", "network"],
|
||||
"author-blocked" => ["author", "blocked"],
|
||||
"author-hidden" => ["author", "hidden"],
|
||||
"author-updated" => ["author", "updated"],
|
||||
"owner-id" => ["post-thread-user", "owner-id"],
|
||||
"owner-link" => ["owner", "url"],
|
||||
"owner-addr" => ["owner", "addr"],
|
||||
|
@ -318,6 +321,7 @@
|
|||
"owner-network" => ["owner", "network"],
|
||||
"owner-blocked" => ["owner", "blocked"],
|
||||
"owner-hidden" => ["owner", "hidden"],
|
||||
"owner-updated" => ["owner", "updated"],
|
||||
"owner-contact-type" => ["owner", "contact-type"],
|
||||
"causer-id" => ["post-thread-user", "causer-id"],
|
||||
"causer-link" => ["causer", "url"],
|
||||
|
@ -458,6 +462,7 @@
|
|||
"author-network" => ["author", "network"],
|
||||
"author-blocked" => ["author", "blocked"],
|
||||
"author-hidden" => ["author", "hidden"],
|
||||
"author-updated" => ["author", "updated"],
|
||||
"owner-id" => ["post", "owner-id"],
|
||||
"owner-link" => ["owner", "url"],
|
||||
"owner-addr" => ["owner", "addr"],
|
||||
|
@ -467,6 +472,7 @@
|
|||
"owner-network" => ["owner", "network"],
|
||||
"owner-blocked" => ["owner", "blocked"],
|
||||
"owner-hidden" => ["owner", "hidden"],
|
||||
"owner-updated" => ["owner", "updated"],
|
||||
"owner-contact-type" => ["owner", "contact-type"],
|
||||
"causer-id" => ["post", "causer-id"],
|
||||
"causer-link" => ["causer", "url"],
|
||||
|
@ -583,6 +589,7 @@
|
|||
"author-network" => ["author", "network"],
|
||||
"author-blocked" => ["author", "blocked"],
|
||||
"author-hidden" => ["author", "hidden"],
|
||||
"author-updated" => ["author", "updated"],
|
||||
"owner-id" => ["post-thread", "owner-id"],
|
||||
"owner-link" => ["owner", "url"],
|
||||
"owner-addr" => ["owner", "addr"],
|
||||
|
@ -592,6 +599,7 @@
|
|||
"owner-network" => ["owner", "network"],
|
||||
"owner-blocked" => ["owner", "blocked"],
|
||||
"owner-hidden" => ["owner", "hidden"],
|
||||
"owner-updated" => ["owner", "updated"],
|
||||
"owner-contact-type" => ["owner", "contact-type"],
|
||||
"causer-id" => ["post-thread", "causer-id"],
|
||||
"causer-link" => ["causer", "url"],
|
||||
|
|
Loading…
Reference in a new issue