From d0cd764c7e3fb47e7d2f151303bee52b514336cb Mon Sep 17 00:00:00 2001 From: Fabricio Santolin da Silva Date: Wed, 16 Jul 2025 17:52:13 +0200 Subject: [PATCH] MT#63070 Add request for sems to clear its audio cache This patch add the request for sems to clear its audio cache when the SoundSet is updated. Change-Id: Id6970b429b211f93d088703dcdfac15dd8d43088 (cherry picked from commit 0850b11f8afe8927885fa291e462354c74a016dd) --- lib/NGCP/Panel/Controller/API/SoundSetsItem.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/NGCP/Panel/Controller/API/SoundSetsItem.pm b/lib/NGCP/Panel/Controller/API/SoundSetsItem.pm index 97ee88a669..3993969445 100644 --- a/lib/NGCP/Panel/Controller/API/SoundSetsItem.pm +++ b/lib/NGCP/Panel/Controller/API/SoundSetsItem.pm @@ -31,6 +31,16 @@ sub get_journal_methods{ sub update_item_model { my ($self, $c, $item, $old_resource, $resource, $form) = @_; + my $old_parent_id = $old_resource->{parent_id}; + my $new_parent_id = $resource->{parent_id}; + if ((!defined $old_parent_id && defined $new_parent_id) + || (defined $old_parent_id && !defined $new_parent_id) + || (defined $old_parent_id && defined $new_parent_id && $old_parent_id != $new_parent_id) + ) { + $c->log->debug("Parent changed: clearing cache for set " . $item->id); + NGCP::Panel::Utils::Sems::clear_audio_cache($c, $item->id); + } + my $copy_from_default_params = { map {$_ => delete $resource->{$_}} (qw/copy_from_default loopplay replace_existing language/) }; $item->update($resource); if ($copy_from_default_params->{copy_from_default}) {