~cytrogen/masto-fe

ref: 85db3924645ebd20f0259356fa7556a2e8055b36 masto-fe/app/services/mute_service.rb -rw-r--r-- 542 bytes
85db3924 — Nick Schonning Autofix Rubocop cops for config/ (#24145) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class MuteService < BaseService
  def call(account, target_account, notifications: nil, duration: 0)
    return if account.id == target_account.id

    mute = account.mute!(target_account, notifications: notifications, duration: duration)

    if mute.hide_notifications?
      BlockWorker.perform_async(account.id, target_account.id)
    else
      MuteWorker.perform_async(account.id, target_account.id)
    end

    DeleteMuteWorker.perform_at(duration.seconds, mute.id) if duration != 0

    mute
  end
end