Skip to content

Commit

Permalink
fix: remove stream on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
didoda committed Jun 27, 2024
1 parent 6f8fb15 commit fd084ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Controller/TrashController.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,15 @@ public function emptyTrash(): ?Response
public function deleteData(string $id): void
{
$response = $this->apiClient->get('/streams', ['filter' => ['object_id' => $id]]);
$streams = (array)Hash::get($response, 'data');
$this->apiClient->remove($id);
// this for BE versions < 5.25.1, where streams are not deleted with media on delete
$streams = (array)Hash::get($response, 'data');
foreach ($streams as $stream) {
$search = $this->apiClient->get('/streams', ['filter' => ['uuid' => $stream['id']]]);
$count = (int)Hash::get($search, 'meta.pagination.count', 0);
if ($count === 0) {
continue;

Check warning on line 262 in src/Controller/TrashController.php

View check run for this annotation

Codecov / codecov/patch

src/Controller/TrashController.php#L262

Added line #L262 was not covered by tests
}
$this->apiClient->delete(sprintf('/streams/%s', $stream['id']));
}
}
Expand Down

0 comments on commit fd084ec

Please sign in to comment.