mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +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)
|
public function transform(Profile $profile)
|
||||||
{
|
{
|
||||||
|
$is_admin = $profile->domain ? false : $profile->user->is_admin;
|
||||||
return [
|
return [
|
||||||
'id' => $profile->id,
|
'id' => (string) $profile->id,
|
||||||
'username' => $profile->username,
|
'username' => $profile->username,
|
||||||
'acct' => $profile->username,
|
'acct' => $profile->username,
|
||||||
'display_name' => $profile->name,
|
'display_name' => $profile->name,
|
||||||
|
@ -28,7 +29,8 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
||||||
'moved' => null,
|
'moved' => null,
|
||||||
'fields' => null,
|
'fields' => null,
|
||||||
'bot' => 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)
|
public function transform(Media $media)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $media->id,
|
'id' => (string) $media->id,
|
||||||
'type' => $media->activityVerb(),
|
'type' => $media->activityVerb(),
|
||||||
'url' => $media->url(),
|
'url' => $media->url(),
|
||||||
'remote_url' => null,
|
'remote_url' => null,
|
||||||
|
|
|
@ -10,7 +10,7 @@ class MediaTransformer extends Fractal\TransformerAbstract
|
||||||
public function transform(Media $media)
|
public function transform(Media $media)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $media->id,
|
'id' => (string) $media->id,
|
||||||
'type' => $media->activityVerb(),
|
'type' => $media->activityVerb(),
|
||||||
'url' => $media->url(),
|
'url' => $media->url(),
|
||||||
'remote_url' => null,
|
'remote_url' => null,
|
||||||
|
|
|
@ -10,7 +10,7 @@ class MentionTransformer extends Fractal\TransformerAbstract
|
||||||
public function transform(Profile $profile)
|
public function transform(Profile $profile)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $profile->id,
|
'id' => (string) $profile->id,
|
||||||
'url' => $profile->url(),
|
'url' => $profile->url(),
|
||||||
'username' => $profile->username,
|
'username' => $profile->username,
|
||||||
'acct' => $profile->username,
|
'acct' => $profile->username,
|
||||||
|
|
|
@ -15,7 +15,7 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
||||||
public function transform(Notification $notification)
|
public function transform(Notification $notification)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $notification->id,
|
'id' => (string) $notification->id,
|
||||||
'type' => $this->replaceTypeVerb($notification->action),
|
'type' => $this->replaceTypeVerb($notification->action),
|
||||||
'created_at' => (string) $notification->created_at,
|
'created_at' => (string) $notification->created_at,
|
||||||
'account' => null,
|
'account' => null,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Transformer\Api;
|
namespace App\Transformer\Api;
|
||||||
|
|
||||||
|
use Auth;
|
||||||
use App\Profile;
|
use App\Profile;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
|
|
||||||
|
@ -9,17 +10,18 @@ class RelationshipTransformer extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
public function transform(Profile $profile)
|
public function transform(Profile $profile)
|
||||||
{
|
{
|
||||||
|
$user = Auth::user()->profile;
|
||||||
return [
|
return [
|
||||||
'id' => $profile->id,
|
'id' => (string) $profile->id,
|
||||||
'following' => null,
|
'following' => $user->follows($profile),
|
||||||
'followed_by' => null,
|
'followed_by' => $user->followedBy($profile),
|
||||||
'blocking' => null,
|
'blocking' => null,
|
||||||
'muting' => null,
|
'muting' => null,
|
||||||
'muting_notifications' => null,
|
'muting_notifications' => null,
|
||||||
'requested' => null,
|
'requested' => null,
|
||||||
'domain_blocking' => null,
|
'domain_blocking' => null,
|
||||||
'showing_reblogs' => null,
|
'showing_reblogs' => null,
|
||||||
'endorsed' => null
|
'endorsed' => false
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
||||||
public function transform(Status $status)
|
public function transform(Status $status)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $status->id,
|
'id' => (string) $status->id,
|
||||||
'uri' => $status->url(),
|
'uri' => $status->url(),
|
||||||
'url' => $status->url(),
|
'url' => $status->url(),
|
||||||
'in_reply_to_id' => $status->in_reply_to_id,
|
'in_reply_to_id' => $status->in_reply_to_id,
|
||||||
|
|
|
@ -14,7 +14,7 @@ class StoryTransformer extends Fractal\TransformerAbstract
|
||||||
public function transform(Story $story)
|
public function transform(Story $story)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $story->id,
|
'id' => (string) $story->id,
|
||||||
'photo' => $story->profile->avatarUrl(),
|
'photo' => $story->profile->avatarUrl(),
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'link' => '',
|
'link' => '',
|
||||||
|
|
Loading…
Reference in a new issue