mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-27 00:33:17 +00:00
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources\MastoApi\Admin;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class DomainBlockResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
$severity = 'noop';
|
|
if ($this->banned) {
|
|
$severity = 'suspend';
|
|
} else if ($this->unlisted) {
|
|
$severity = 'silence';
|
|
}
|
|
|
|
return [
|
|
'id' => $this->id,
|
|
'domain' => $this->domain,
|
|
'severity' => $severity,
|
|
// Using the updated_at value as this is going to be the closest to
|
|
// when the domain was banned
|
|
'created_at' => $this->updated_at,
|
|
// We don't have data for these fields
|
|
'reject_media' => false,
|
|
'reject_reports' => false,
|
|
'private_comment' => $this->notes ? join('; ', $this->notes) : null,
|
|
'public_comment' => $this->limit_reason,
|
|
'obfuscate' => false
|
|
];
|
|
}
|
|
}
|