mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-24 03:23:48 -05:00
16 lines
536 B
Ruby
16 lines
536 B
Ruby
# frozen_string_literal: true
|
|
|
|
class MuteService < BaseService
|
|
def call(account, target_account, notifications: nil)
|
|
return if account.id == target_account.id
|
|
FeedManager.instance.clear_from_timeline(account, target_account)
|
|
# This unwieldy approach avoids duplicating the default value here
|
|
# and in mute!.
|
|
opts = {}
|
|
opts[:notifications] = notifications unless notifications.nil?
|
|
mute = account.mute!(target_account, **opts)
|
|
BlockWorker.perform_async(account.id, target_account.id)
|
|
mute
|
|
end
|
|
end
|