mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +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 App\Profile;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class AccountTransformer extends Fractal\TransformerAbstract
|
class AccountTransformer extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
|
@ -11,12 +12,11 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
$local = $profile->domain == null;
|
$local = $profile->domain == null;
|
||||||
$is_admin = !$local ? false : $profile->user->is_admin;
|
$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('@', substr($profile->username, 1))[0];
|
||||||
$username = $local ? $profile->username : explode('@', $acct)[0];
|
|
||||||
return [
|
return [
|
||||||
'id' => (string) $profile->id,
|
'id' => (string) $profile->id,
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'acct' => $acct,
|
'acct' => $username,
|
||||||
'display_name' => $profile->name,
|
'display_name' => $profile->name,
|
||||||
'locked' => (bool) $profile->is_private,
|
'locked' => (bool) $profile->is_private,
|
||||||
'created_at' => $profile->created_at->toJSON(),
|
'created_at' => $profile->created_at->toJSON(),
|
||||||
|
@ -32,7 +32,7 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
||||||
'emojis' => [],
|
'emojis' => [],
|
||||||
'moved' => null,
|
'moved' => null,
|
||||||
'fields' => null,
|
'fields' => null,
|
||||||
'bot' => null,
|
'bot' => false,
|
||||||
'software' => 'pixelfed',
|
'software' => 'pixelfed',
|
||||||
'is_admin' => (bool) $is_admin,
|
'is_admin' => (bool) $is_admin,
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue