mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Use "avatar" instead of "contact"
This commit is contained in:
parent
7e747b2f41
commit
9a1abda314
3 changed files with 29 additions and 29 deletions
|
@ -76,22 +76,22 @@ class Account extends BaseFactory
|
|||
*/
|
||||
public function createFromUriId(int $contactUriId, $uid = 0): \Friendica\Object\Api\Mastodon\Account
|
||||
{
|
||||
$contact = DBA::selectFirst('account-user-view', [], ['uri-id' => $contactUriId, 'uid' => [0, $uid]], ['order' => ['id' => true]]);
|
||||
if (empty($contact)) {
|
||||
$avatar = DBA::selectFirst('account-user-view', [], ['uri-id' => $contactUriId, 'uid' => [0, $uid]], ['order' => ['id' => true]]);
|
||||
if (empty($avatar)) {
|
||||
throw new HTTPException\NotFoundException('Contact ' . $contactUriId . ' not found');
|
||||
}
|
||||
|
||||
$fields = new Fields();
|
||||
|
||||
if (Contact::isLocal($contact['url'])) {
|
||||
$self_contact = Contact::selectFirst(['uid'], ['nurl' => $contact['nurl'], 'self' => true]);
|
||||
if (Contact::isLocal($avatar['url'])) {
|
||||
$self_contact = Contact::selectFirst(['uid'], ['nurl' => $avatar['nurl'], 'self' => true]);
|
||||
if (!empty($self_contact['uid'])) {
|
||||
$profileFields = $this->profileFieldRepo->selectPublicFieldsByUserId($self_contact['uid']);
|
||||
$fields = $this->mstdnFieldFactory->createFromProfileFields($profileFields);
|
||||
}
|
||||
}
|
||||
|
||||
return new \Friendica\Object\Api\Mastodon\Account($this->baseUrl, $contact, $fields);
|
||||
return new \Friendica\Object\Api\Mastodon\Account($this->baseUrl, $avatar, $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,10 +101,10 @@ class Account extends BaseFactory
|
|||
*/
|
||||
public function createFromUserId(int $userId): \Friendica\Object\Api\Mastodon\Account
|
||||
{
|
||||
$contact = DBA::selectFirst('account-user-view', [], ['uid' => $userId, 'self' => true]);
|
||||
$avatar = DBA::selectFirst('account-user-view', [], ['uid' => $userId, 'self' => true]);
|
||||
$profileFields = $this->profileFieldRepo->selectPublicFieldsByUserId($userId);
|
||||
$fields = $this->mstdnFieldFactory->createFromProfileFields($profileFields);
|
||||
|
||||
return new \Friendica\Object\Api\Mastodon\Account($this->baseUrl, $contact, $fields);
|
||||
return new \Friendica\Object\Api\Mastodon\Account($this->baseUrl, $avatar, $fields);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class Status extends BaseFactory
|
|||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws ImagickException|HTTPException\NotFoundException
|
||||
*/
|
||||
public function createFromUriId(int $uriId, $uid = 0, $item = []): \Friendica\Object\Api\Mastodon\Status
|
||||
public function createFromUriId(int $uriId, $uid = 0): \Friendica\Object\Api\Mastodon\Status
|
||||
{
|
||||
$fields = ['uri-id', 'uid', 'author-id', 'author-uri-id', 'author-link', 'starred', 'app', 'title', 'body', 'raw-body', 'content-warning', 'question-id',
|
||||
'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity', 'featured', 'has-media'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue