mirror of
https://github.com/friendica/friendica
synced 2025-04-26 13:10:11 +00:00
API: Account actions
This commit is contained in:
parent
5ade228c63
commit
45c2cc3887
13 changed files with 399 additions and 32 deletions
|
@ -44,9 +44,9 @@ class Account extends BaseFactory
|
|||
{
|
||||
parent::__construct($logger);
|
||||
|
||||
$this->baseUrl = $baseURL;
|
||||
$this->baseUrl = $baseURL;
|
||||
$this->profileField = $profileField;
|
||||
$this->mstdnField = $mstdnField;
|
||||
$this->mstdnField = $mstdnField;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ class Account extends BaseFactory
|
|||
$cdata = Contact::getPublicAndUserContacID($contactId, $uid);
|
||||
if (!empty($cdata)) {
|
||||
$publicContact = Contact::getById($cdata['public']);
|
||||
$userContact = Contact::getById($cdata['user']);
|
||||
$userContact = Contact::getById($cdata['user']);
|
||||
} else {
|
||||
$publicContact = Contact::getById($contactId);
|
||||
$userContact = [];
|
||||
|
|
|
@ -37,13 +37,33 @@ class Relationship extends BaseFactory
|
|||
return $this->createFromContact(Contact::getById($userContactId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $publicContactId Contact row id with uid = 0
|
||||
* @param int $uid User ID
|
||||
* @return RelationshipEntity
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function createFromPublicContactId(int $publicContactId, int $uid)
|
||||
{
|
||||
$cdata = Contact::getPublicAndUserContacID($publicContactId, $uid);
|
||||
if (!empty($cdata)) {
|
||||
$cid = $cdata['user'];
|
||||
} else {
|
||||
$cid = $publicContactId;
|
||||
}
|
||||
|
||||
return $this->createFromContact(Contact::getById($cid));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $userContact Full contact row record with uid != 0
|
||||
* @return RelationshipEntity
|
||||
*/
|
||||
public function createFromContact(array $userContact)
|
||||
{
|
||||
return new RelationshipEntity($userContact['id'], $userContact);
|
||||
return new RelationshipEntity($userContact['id'], $userContact,
|
||||
Contact\User::isBlocked($userContact['id'], $userContact['uid']),
|
||||
Contact\User::isIgnored($userContact['id'], $userContact['uid']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue