diff options
Diffstat (limited to 'app/lib/command_tag')
-rw-r--r-- | app/lib/command_tag/command/status_tools.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/app/lib/command_tag/command/status_tools.rb b/app/lib/command_tag/command/status_tools.rb index 1727a956e..1cdb90e4a 100644 --- a/app/lib/command_tag/command/status_tools.rb +++ b/app/lib/command_tag/command/status_tools.rb @@ -1,11 +1,29 @@ # frozen_string_literal: true module CommandTag::Command::StatusTools + def handle_article_before_save(args) + return unless author_of_status? && args.present? + + case args.shift.downcase + when 'title', 'name', 't' + status.title = args.join(' ') + when 'summary', 'abstract', 'cw', 'cn', 's', 'a' + @status.title = @status.spoiler_text if @status.title.blank? + @status.spoiler_text = args.join(' ') + end + end + def handle_title_before_save(args) - return unless author_of_status? + args.unshift('title') + handle_article_before_save(args) + end - @status.title = args[0] + def handle_summary_before_save(args) + args.unshift('summary') + handle_article_before_save(args) end + alias handle_abstract_before_save handle_summary_before_save + def handle_visibility_before_save(args) return unless author_of_status? && args[0].present? |