mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 00:04:50 +00:00
Update AdminReport
This commit is contained in:
parent
80ee8a7414
commit
c4b5148b17
1 changed files with 25 additions and 17 deletions
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
namespace App\Http\Resources;
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
|
||||||
use App\Services\AccountService;
|
use App\Services\AccountService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
|
use App\Story;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class AdminReport extends JsonResource
|
class AdminReport extends JsonResource
|
||||||
{
|
{
|
||||||
|
@ -16,22 +17,29 @@ class AdminReport extends JsonResource
|
||||||
*/
|
*/
|
||||||
public function toArray(Request $request): array
|
public function toArray(Request $request): array
|
||||||
{
|
{
|
||||||
$res = [
|
$res = [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'reporter' => AccountService::get($this->profile_id, true),
|
'reporter' => AccountService::get($this->profile_id, true),
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'object_id' => (string) $this->object_id,
|
'object_id' => (string) $this->object_id,
|
||||||
'object_type' => $this->object_type,
|
'object_type' => $this->object_type,
|
||||||
'reported' => AccountService::get($this->reported_profile_id, true),
|
'reported' => AccountService::get($this->reported_profile_id, true),
|
||||||
'status' => null,
|
'status' => null,
|
||||||
'reporter_message' => $this->message,
|
'reporter_message' => $this->message,
|
||||||
'admin_seen_at' => $this->admin_seen,
|
'admin_seen_at' => $this->admin_seen,
|
||||||
'created_at' => $this->created_at,
|
'created_at' => $this->created_at,
|
||||||
];
|
];
|
||||||
|
|
||||||
if($this->object_id && $this->object_type === 'App\Status') {
|
if ($this->object_id && $this->object_type === 'App\Status') {
|
||||||
$res['status'] = StatusService::get($this->object_id, false);
|
$res['status'] = StatusService::get($this->object_id, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->object_id && $this->object_type === 'App\Story') {
|
||||||
|
$story = Story::find($this->object_id);
|
||||||
|
if ($story) {
|
||||||
|
$res['story'] = $story->toAdminEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue