From 5f2e372cf580307843e0fc813f7ddd7e3c0a0906 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Sun, 2 Aug 2020 09:40:32 -0500 Subject: [Command Tags] Unpublish status before destroying --- app/lib/command_tag/processor.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/lib/command_tag/processor.rb b/app/lib/command_tag/processor.rb index a4b8490f7..0c589364d 100644 --- a/app/lib/command_tag/processor.rb +++ b/app/lib/command_tag/processor.rb @@ -65,6 +65,7 @@ class CommandTag::Processor unless (@status.published? && !@status.edited.zero?) || @text.present? execute_statements(:before_destroy) + @status.update(published: false) @status.destroy execute_statements(:after_destroy) end @@ -217,7 +218,10 @@ class CommandTag::Processor end def destroy_status! - @status.destroy unless @status.destroyed? + return if @status.destroyed? + + @status.update(published: false) + @status.destroy end def normalize(text) -- cgit