Rename Api\Mastodon\Account::createFromContact to just create
- Retrieve public contact in Api\Mastodon\FollowRequests instead of user contact
This commit is contained in:
parent
9ed8479b32
commit
cb7875b035
4 changed files with 15 additions and 10 deletions
|
@ -61,7 +61,7 @@ class Account
|
|||
* @return Account
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function createFromContact(array $publicContact, array $apcontact = [])
|
||||
public static function create(array $publicContact, array $apcontact = [])
|
||||
{
|
||||
$account = new Account();
|
||||
$account->id = $publicContact['id'];
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
namespace Friendica\Api\Mastodon;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Api\Mastodon\Account;
|
||||
use Friendica\Api\Mastodon\Stats;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -58,15 +56,17 @@ class Instance
|
|||
{
|
||||
$register_policy = intval(Config::get('config', 'register_policy'));
|
||||
|
||||
$baseUrl = DI::baseUrl();
|
||||
|
||||
$instance = new Instance();
|
||||
$instance->uri = DI::baseUrl()->get();
|
||||
$instance->uri = $baseUrl->get();
|
||||
$instance->title = Config::get('config', 'sitename');
|
||||
$instance->description = Config::get('config', 'info');
|
||||
$instance->email = Config::get('config', 'admin_email');
|
||||
$instance->version = FRIENDICA_VERSION;
|
||||
$instance->urls = []; // Not supported
|
||||
$instance->stats = Stats::get();
|
||||
$instance->thumbnail = DI::baseUrl()->get() . (Config::get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
|
||||
$instance->thumbnail = $baseUrl->get() . (Config::get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
|
||||
$instance->languages = [Config::get('system', 'language')];
|
||||
$instance->max_toot_chars = (int)Config::get('config', 'api_import_size', Config::get('config', 'max_import_size'));
|
||||
$instance->registrations = ($register_policy != Register::CLOSED);
|
||||
|
@ -79,7 +79,7 @@ class Instance
|
|||
if (!empty($administrator)) {
|
||||
$adminContact = DBA::selectFirst('contact', [], ['nick' => $administrator['nickname'], 'self' => true]);
|
||||
$apcontact = APContact::getByURL($adminContact['url'], false);
|
||||
$instance->contact_account = Account::createFromContact($adminContact, $apcontact);
|
||||
$instance->contact_account = Account::create($adminContact, $apcontact);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,9 +87,14 @@ class FollowRequests extends Api
|
|||
|
||||
$return = [];
|
||||
foreach ($intros as $intro) {
|
||||
$contact = Contact::getById($intro['contact-id']);
|
||||
$apcontact = APContact::getByURL($contact['url'], false);
|
||||
$account = Mastodon\Account::createFromContact($contact, $apcontact);
|
||||
$cdata = Contact::getPublicAndUserContacID($intro['contact-id'], $intro['uid']);
|
||||
if (empty($cdata['public'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$publicContact = Contact::getById($cdata['public']);
|
||||
$apcontact = APContact::getByURL($publicContact['url'], false);
|
||||
$account = Mastodon\Account::create($publicContact, $apcontact);
|
||||
|
||||
// Not ideal, the same "account" can have multiple ids depending on the context
|
||||
$account->id = $intro['id'];
|
||||
|
|
|
@ -13,7 +13,7 @@ class Instance extends Api
|
|||
{
|
||||
/**
|
||||
* @param array $parameters
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue