gab-social/app/services/report_service.rb

30 lines
647 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
return nil if @target_account.suspended_at != nil
2019-07-02 08:10:25 +01:00
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