about summary refs log tree commit diff
path: root/app/services/report_service.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-02-10 21:07:48 +0100
committerGitHub <noreply@github.com>2022-02-10 21:07:48 +0100
commit776e337b8d2aa66440bc4565617b5440ca781e1a (patch)
treed9d30c63622c58a343cea58a3509337630491609 /app/services/report_service.rb
parentd602c92b310545eb733a58caed49717341abe27c (diff)
parent642b5a621acdcae091f8bdb0f367018309616f71 (diff)
Merge pull request #1683 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/services/report_service.rb')
-rw-r--r--app/services/report_service.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/services/report_service.rb b/app/services/report_service.rb
index bc0a8b464..caf99ab6e 100644
--- a/app/services/report_service.rb
+++ b/app/services/report_service.rb
@@ -8,13 +8,15 @@ class ReportService < BaseService
     @target_account = target_account
     @status_ids     = options.delete(:status_ids) || []
     @comment        = options.delete(:comment) || ''
+    @category       = options.delete(:category) || 'other'
+    @rule_ids       = options.delete(:rule_ids)
     @options        = options
 
     raise ActiveRecord::RecordNotFound if @target_account.suspended?
 
     create_report!
     notify_staff!
-    forward_to_origin! if !@target_account.local? && ActiveModel::Type::Boolean.new.cast(@options[:forward])
+    forward_to_origin! if forward?
 
     @report
   end
@@ -27,7 +29,9 @@ class ReportService < BaseService
       status_ids: @status_ids,
       comment: @comment,
       uri: @options[:uri],
-      forwarded: ActiveModel::Type::Boolean.new.cast(@options[:forward])
+      forwarded: forward?,
+      category: @category,
+      rule_ids: @rule_ids
     )
   end
 
@@ -48,6 +52,10 @@ class ReportService < BaseService
     )
   end
 
+  def forward?
+    !@target_account.local? && ActiveModel::Type::Boolean.new.cast(@options[:forward])
+  end
+
   def payload
     Oj.dump(serialize_payload(@report, ActivityPub::FlagSerializer, account: some_local_account))
   end