Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Api/Serializer/ExportSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ protected function getDefaultAttributes($export)
return $attributes;
}

protected function user($export): Relationship
protected function user($export): ?Relationship
{
return $this->hasOne($export, BasicUserSerializer::class);
}

protected function actor($export): Relationship
protected function actor($export): ?Relationship
{
return $this->hasOne($export, BasicUserSerializer::class);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Serializer/RequestErasureSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ protected function getDefaultAttributes($erasure_request)
];
}

protected function user($erasure_request): Relationship
protected function user($erasure_request): ?Relationship
{
return $this->hasOne($erasure_request, BasicUserSerializer::class);
}

protected function processedBy($erasure_request): Relationship
protected function processedBy($erasure_request): ?Relationship
{
return $this->hasOne($erasure_request, BasicUserSerializer::class);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controller/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
200,
[
'Content-Type' => 'application/zip',
'Content-Length' => $this->storageManager->getStoredExportSize($export),
'Content-Length' => (string) $this->storageManager->getStoredExportSize($export),
'Content-Disposition' => 'attachment; filename="data-export-'.$export->user->username.'-'.$export->created_at->toIso8601String().'.zip"',
]
);
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/api/ProcessErasureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ public function authorized_users_can_see_confirmed_erasure_requests()
$this->assertEquals(ErasureRequest::STATUS_USER_CONFIRMED, $json['data'][0]['attributes']['status']);
}

/**
* @test
*/
public function authorized_users_can_see_confirmed_erasure_requests_even_if_user_was_deleted()
{
$this->send($this->request('GET', '/api/forum'));
User::query()->where('id', 5)->delete();

$response = $this->send(
$this->request('GET', '/api/user-erasure-requests', [
'authenticatedAs' => 3,
])
);

$this->assertEquals(200, $response->getStatusCode());

$json = json_decode($response->getBody()->getContents(), true);

$this->assertCount(1, $json['data']);
$this->assertEquals(ErasureRequest::STATUS_USER_CONFIRMED, $json['data'][0]['attributes']['status']);
}

/**
* @test
*/
Expand Down
Loading