From 45e04f00db91cc2956707a84a87dfdfce05363e4 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Fri, 31 Jul 2020 01:26:57 -0500 Subject: [Command Tags] Move blank post check to utility method --- 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 414c08638..aba7be158 100644 --- a/app/lib/command_tag/processor.rb +++ b/app/lib/command_tag/processor.rb @@ -58,7 +58,7 @@ class CommandTag::Processor @text = parse_templates(@text).rstrip execute_statements(:before_save) - if @text.blank? || @text.gsub(MENTIONS_OR_HASHTAGS_RE, '').strip.blank? + if status_text_blank? execute_statements(:when_blank) unless (@status.published? && !@status.edited.zero?) || @text.present? @@ -210,6 +210,10 @@ class CommandTag::Processor @account.id == @parent&.account_id end + def status_text_blank? + @text.blank? || @text.gsub(MENTIONS_OR_HASHTAGS_RE, '').strip.blank? + end + def destroy_status! @status.destroy unless @status.destroyed? end -- cgit