diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-16 03:24:47 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:18 -0500 |
commit | 6e28a99c8e46295dd049f7af45565d4bea97c725 (patch) | |
tree | 1091cdf9ef010e4edc61e188835f8a691077a6ff /app/lib/command_tag | |
parent | d7a405e5e7df0d792a75f27fa404e76ab46aad66 (diff) |
[Feature] Full article support
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? |