about summary refs log tree commit diff
path: root/app/lib/command_tag/command/status_tools.rb
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-08-23 09:38:27 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:20 -0500
commit5622de4a785e6b7c9a4946af3efaf8b4c2bc5755 (patch)
treeb9378500aa449af54ac09c44b2aba8f6ee2a184b /app/lib/command_tag/command/status_tools.rb
parent5de7e2d667fa55f353a8b3d988cd047c118a4250 (diff)
[Feature] Support Misskey-compatible boosts with attached content notes
Diffstat (limited to 'app/lib/command_tag/command/status_tools.rb')
-rw-r--r--app/lib/command_tag/command/status_tools.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/lib/command_tag/command/status_tools.rb b/app/lib/command_tag/command/status_tools.rb
index 1cdb90e4a..5cc11dde2 100644
--- a/app/lib/command_tag/command/status_tools.rb
+++ b/app/lib/command_tag/command/status_tools.rb
@@ -1,5 +1,19 @@
 # frozen_string_literal: true
 module CommandTag::Command::StatusTools
+  def handle_boost_once_at_start(args)
+    return unless @parent.present? && StatusPolicy.new(@account, @parent).reblog?
+
+    status = ReblogService.new.call(
+      @account, @parent,
+      visibility: @status.visibility,
+      spoiler_text: args.join(' ').presence || @status.spoiler_text
+    )
+  end
+
+  alias handle_reblog_at_start handle_boost_once_at_start
+  alias handle_rb_at_start handle_boost_once_at_start
+  alias handle_rt_at_start handle_boost_once_at_start
+
   def handle_article_before_save(args)
     return unless author_of_status? && args.present?