diff --git a/lib/NGCP/Panel/Controller/API/SoundFilesItem.pm b/lib/NGCP/Panel/Controller/API/SoundFilesItem.pm index 63bd30906e..e5f7389b0b 100644 --- a/lib/NGCP/Panel/Controller/API/SoundFilesItem.pm +++ b/lib/NGCP/Panel/Controller/API/SoundFilesItem.pm @@ -135,6 +135,14 @@ sub DELETE :Allow { $guard->commit; + # clear audio caches + my $group_name = $item->handle->group->name; + try { + NGCP::Panel::Utils::Sems::clear_audio_cache($c, $item->set_id, $item->handle->name, $group_name); + } catch ($e) { + $c->log->warn("Failed to clear audio cache for group " . $group_name); + } + $c->response->status(HTTP_NO_CONTENT); $c->response->body(q()); } diff --git a/lib/NGCP/Panel/Controller/Sound.pm b/lib/NGCP/Panel/Controller/Sound.pm index 6b3d5aa1b4..4dac355791 100644 --- a/lib/NGCP/Panel/Controller/Sound.pm +++ b/lib/NGCP/Panel/Controller/Sound.pm @@ -670,6 +670,16 @@ sub handles_delete :Chained('handles_base') :PathPart('delete') { desc => $c->loc('Failed to delete sound handle'), ); }; + + # clear audio caches + my $handle = $c->stash->{file_result}->handle; + my $group_name = $handle->group->name; + try { + NGCP::Panel::Utils::Sems::clear_audio_cache($c, $c->stash->{file_result}->set_id, $handle->name, $group_name); + } catch ($e) { + $c->log->warn("Failed to clear audio cache for group " . $group_name); + } + NGCP::Panel::Utils::Navigation::back_or($c, $c->stash->{handles_base_uri}); return; }