30 lines
647 B
Ruby
30 lines
647 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ReportService < BaseService
|
|
def call(source_account, target_account, options = {})
|
|
@source_account = source_account
|
|
@target_account = target_account
|
|
@status_ids = options.delete(:status_ids) || []
|
|
@comment = options.delete(:comment) || ''
|
|
@options = options
|
|
|
|
return nil if @target_account.suspended_at != nil
|
|
|
|
create_report!
|
|
|
|
@report
|
|
end
|
|
|
|
private
|
|
|
|
def create_report!
|
|
@report = @source_account.reports.create!(
|
|
target_account: @target_account,
|
|
status_ids: @status_ids,
|
|
comment: @comment,
|
|
uri: @options[:uri]
|
|
)
|
|
end
|
|
|
|
end
|