mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update AccountTransformer, fixes #1730
This commit is contained in:
parent
715166fc67
commit
21f262315d
1 changed files with 4 additions and 4 deletions
|
@ -4,6 +4,7 @@ namespace App\Transformer\Api\Mastodon\v1;
|
|||
|
||||
use App\Profile;
|
||||
use League\Fractal;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class AccountTransformer extends Fractal\TransformerAbstract
|
||||
{
|
||||
|
@ -11,12 +12,11 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
{
|
||||
$local = $profile->domain == null;
|
||||
$is_admin = !$local ? false : $profile->user->is_admin;
|
||||
$acct = $local ? $profile->username . '@' . config('pixelfed.domain.app') : substr($profile->username, 1);
|
||||
$username = $local ? $profile->username : explode('@', $acct)[0];
|
||||
$username = $local ? $profile->username : explode('@', substr($profile->username, 1))[0];
|
||||
return [
|
||||
'id' => (string) $profile->id,
|
||||
'username' => $username,
|
||||
'acct' => $acct,
|
||||
'acct' => $username,
|
||||
'display_name' => $profile->name,
|
||||
'locked' => (bool) $profile->is_private,
|
||||
'created_at' => $profile->created_at->toJSON(),
|
||||
|
@ -32,7 +32,7 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
'emojis' => [],
|
||||
'moved' => null,
|
||||
'fields' => null,
|
||||
'bot' => null,
|
||||
'bot' => false,
|
||||
'software' => 'pixelfed',
|
||||
'is_admin' => (bool) $is_admin,
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue