gab-social/app/services/report_service.rb

28 lines
592 B
Ruby
Raw Normal View History

2019-07-02 08:10:25 +01:00
# 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
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