mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update Api Transformers, force string type for ids
This commit is contained in:
parent
d8bd9f7f0c
commit
261c33e7d8
8 changed files with 16 additions and 12 deletions
|
@ -9,8 +9,9 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
{
|
||||
public function transform(Profile $profile)
|
||||
{
|
||||
$is_admin = $profile->domain ? false : $profile->user->is_admin;
|
||||
return [
|
||||
'id' => $profile->id,
|
||||
'id' => (string) $profile->id,
|
||||
'username' => $profile->username,
|
||||
'acct' => $profile->username,
|
||||
'display_name' => $profile->name,
|
||||
|
@ -28,7 +29,8 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
|||
'moved' => null,
|
||||
'fields' => null,
|
||||
'bot' => null,
|
||||
'software' => 'pixelfed'
|
||||
'software' => 'pixelfed',
|
||||
'is_admin' => (bool) $is_admin
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ class AttachmentTransformer extends Fractal\TransformerAbstract
|
|||
public function transform(Media $media)
|
||||
{
|
||||
return [
|
||||
'id' => $media->id,
|
||||
'id' => (string) $media->id,
|
||||
'type' => $media->activityVerb(),
|
||||
'url' => $media->url(),
|
||||
'remote_url' => null,
|
||||
|
|
|
@ -10,7 +10,7 @@ class MediaTransformer extends Fractal\TransformerAbstract
|
|||
public function transform(Media $media)
|
||||
{
|
||||
return [
|
||||
'id' => $media->id,
|
||||
'id' => (string) $media->id,
|
||||
'type' => $media->activityVerb(),
|
||||
'url' => $media->url(),
|
||||
'remote_url' => null,
|
||||
|
|
|
@ -10,7 +10,7 @@ class MentionTransformer extends Fractal\TransformerAbstract
|
|||
public function transform(Profile $profile)
|
||||
{
|
||||
return [
|
||||
'id' => $profile->id,
|
||||
'id' => (string) $profile->id,
|
||||
'url' => $profile->url(),
|
||||
'username' => $profile->username,
|
||||
'acct' => $profile->username,
|
||||
|
|
|
@ -15,7 +15,7 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
|||
public function transform(Notification $notification)
|
||||
{
|
||||
return [
|
||||
'id' => $notification->id,
|
||||
'id' => (string) $notification->id,
|
||||
'type' => $this->replaceTypeVerb($notification->action),
|
||||
'created_at' => (string) $notification->created_at,
|
||||
'account' => null,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Transformer\Api;
|
||||
|
||||
use Auth;
|
||||
use App\Profile;
|
||||
use League\Fractal;
|
||||
|
||||
|
@ -9,17 +10,18 @@ class RelationshipTransformer extends Fractal\TransformerAbstract
|
|||
{
|
||||
public function transform(Profile $profile)
|
||||
{
|
||||
$user = Auth::user()->profile;
|
||||
return [
|
||||
'id' => $profile->id,
|
||||
'following' => null,
|
||||
'followed_by' => null,
|
||||
'id' => (string) $profile->id,
|
||||
'following' => $user->follows($profile),
|
||||
'followed_by' => $user->followedBy($profile),
|
||||
'blocking' => null,
|
||||
'muting' => null,
|
||||
'muting_notifications' => null,
|
||||
'requested' => null,
|
||||
'domain_blocking' => null,
|
||||
'showing_reblogs' => null,
|
||||
'endorsed' => null
|
||||
'endorsed' => false
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
public function transform(Status $status)
|
||||
{
|
||||
return [
|
||||
'id' => $status->id,
|
||||
'id' => (string) $status->id,
|
||||
'uri' => $status->url(),
|
||||
'url' => $status->url(),
|
||||
'in_reply_to_id' => $status->in_reply_to_id,
|
||||
|
|
|
@ -14,7 +14,7 @@ class StoryTransformer extends Fractal\TransformerAbstract
|
|||
public function transform(Story $story)
|
||||
{
|
||||
return [
|
||||
'id' => $story->id,
|
||||
'id' => (string) $story->id,
|
||||
'photo' => $story->profile->avatarUrl(),
|
||||
'name' => '',
|
||||
'link' => '',
|
||||
|
|
Loading…
Reference in a new issue