2017-02-05 19:51:56 -06:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class MuteService < BaseService
|
2018-01-25 22:38:02 -06:00
|
|
|
def call(account, target_account, notifications: nil, note: nil)
|
2017-02-05 19:51:56 -06:00
|
|
|
return if account.id == target_account.id
|
2018-01-25 22:38:02 -06:00
|
|
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
mute = account.mute!(target_account, notifications: notifications)
|
2018-01-25 22:42:19 -06:00
|
|
|
mute.create_note!(note: note) if !note.blank?
|
2018-01-25 22:38:02 -06:00
|
|
|
BlockWorker.perform_async(account.id, target_account.id)
|
|
|
|
mute
|
|
|
|
end
|
2017-02-05 19:51:56 -06:00
|
|
|
end
|
|
|
|
end
|