kopia lustrzana https://github.com/nextcloud/social
add icon to actor
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/1663/head
rodzic
3b2e834dc3
commit
9ae0c19dfa
|
@ -58,9 +58,9 @@ class CacheActorsRequestBuilder extends CoreRequestBuilder {
|
|||
/**
|
||||
* Base of the Sql Update request
|
||||
*
|
||||
* @return IQueryBuilder
|
||||
* @return SocialQueryBuilder
|
||||
*/
|
||||
protected function getCacheActorsUpdateSql(): IQueryBuilder {
|
||||
protected function getCacheActorsUpdateSql(): SocialQueryBuilder {
|
||||
$qb = $this->getQueryBuilder();
|
||||
$qb->update(self::TABLE_CACHE_ACTORS);
|
||||
|
||||
|
|
|
@ -170,8 +170,6 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
|||
}
|
||||
|
||||
$expr = $this->expr();
|
||||
$func = $this->func();
|
||||
|
||||
$pf = (($alias === '') ? $this->getDefaultSelectAlias() : $alias);
|
||||
$this->selectAlias('cd.id', 'cachedocument_id')
|
||||
->selectAlias('cd.type', 'cachedocument_type')
|
||||
|
|
|
@ -697,6 +697,12 @@ class Person extends ACore implements IQueryRow, JsonSerializable {
|
|||
->setFeatured($this->validate(self::AS_URL, 'featured', $data, ''))
|
||||
->setDetailsAll($this->getArray('details', $data, []));
|
||||
|
||||
if ($this->hasIcon()) {
|
||||
$this->setAvatar($this->getIcon()->getUrl());
|
||||
} else {
|
||||
$this->setAvatar($this->getAvatar());
|
||||
}
|
||||
|
||||
try {
|
||||
$cTime = new DateTime($this->get('creation', $data, 'yesterday'));
|
||||
$this->setCreation($cTime->getTimestamp());
|
||||
|
@ -722,27 +728,38 @@ class Person extends ACore implements IQueryRow, JsonSerializable {
|
|||
* @return array
|
||||
*/
|
||||
public function exportAsActivityPub(): array {
|
||||
$data = [
|
||||
'aliases' => [
|
||||
$this->getUrlSocial() . '@' . $this->getPreferredUsername(),
|
||||
$this->getUrlSocial() . 'users/' . $this->getPreferredUsername()
|
||||
],
|
||||
'preferredUsername' => $this->getPreferredUsername(),
|
||||
'name' => $this->getName(),
|
||||
'inbox' => $this->getInbox(),
|
||||
'outbox' => $this->getOutbox(),
|
||||
'account' => $this->getAccount(),
|
||||
'following' => $this->getFollowing(),
|
||||
'followers' => $this->getFollowers(),
|
||||
'endpoints' => ['sharedInbox' => $this->getSharedInbox()],
|
||||
'publicKey' => [
|
||||
'id' => $this->getId() . '#main-key',
|
||||
'owner' => $this->getId(),
|
||||
'publicKeyPem' => $this->getPublicKey()
|
||||
]
|
||||
];
|
||||
|
||||
if ($this->hasIcon()) {
|
||||
$icon = $this->getIcon();
|
||||
$data['icon'] = [
|
||||
'type' => $icon->getType(),
|
||||
'mediaType' => $icon->getMediaType(),
|
||||
'url' => $icon->getUrl()
|
||||
];
|
||||
}
|
||||
|
||||
$result = array_merge(
|
||||
parent::exportAsActivityPub(),
|
||||
[
|
||||
'aliases' => [
|
||||
$this->getUrlSocial() . '@' . $this->getPreferredUsername(),
|
||||
$this->getUrlSocial() . 'users/' . $this->getPreferredUsername()
|
||||
],
|
||||
'preferredUsername' => $this->getPreferredUsername(),
|
||||
'name' => $this->getName(),
|
||||
'inbox' => $this->getInbox(),
|
||||
'outbox' => $this->getOutbox(),
|
||||
'account' => $this->getAccount(),
|
||||
'following' => $this->getFollowing(),
|
||||
'followers' => $this->getFollowers(),
|
||||
'endpoints' => ['sharedInbox' => $this->getSharedInbox()],
|
||||
'publicKey' => [
|
||||
'id' => $this->getId() . '#main-key',
|
||||
'owner' => $this->getId(),
|
||||
'publicKeyPem' => $this->getPublicKey()
|
||||
]
|
||||
]
|
||||
$data
|
||||
);
|
||||
|
||||
if ($this->isCompleteDetails()) {
|
||||
|
|
Ładowanie…
Reference in New Issue