Improved self contact detection

This commit is contained in:
Michael 2020-10-25 20:40:25 +00:00
parent d8d96e6e61
commit 44a4b66539
2 changed files with 5 additions and 4 deletions

View file

@ -69,8 +69,9 @@ class Account extends BaseFactory
$apcontact = APContact::getByURL($publicContact['url'], false);
if (!empty($userContact['self'])) {
$profileFields = $this->profileField->select(['uid' => $uid, 'psid' => PermissionSet::PUBLIC]);
$self_contact = Contact::selectFirst(['uid'], ['nurl' => $publicContact['nurl'], 'self' => true]);
if (!empty($self_contact['uid'])) {
$profileFields = $this->profileField->select(['uid' => $self_contact['uid'], 'psid' => PermissionSet::PUBLIC]);
$fields = $this->mstdnField->createFromProfileFields($profileFields);
} else {
$fields = new Fields();

View file

@ -93,8 +93,8 @@ class Instance extends BaseEntity
$adminList = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
$administrator = User::getByEmail($adminList[0], ['nickname']);
if (!empty($administrator)) {
$adminContact = DBA::selectFirst('contact', ['id', 'uid'], ['nick' => $administrator['nickname'], 'self' => true]);
$instance->contact_account = DI::mstdnAccount()->createFromContactId($adminContact['id'], $adminContact['uid']);
$adminContact = DBA::selectFirst('contact', ['id'], ['nick' => $administrator['nickname'], 'self' => true]);
$instance->contact_account = DI::mstdnAccount()->createFromContactId($adminContact['id']);
}
}