mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-02 13:03:05 -05:00
5e6a09498a
In this commit, we also push note creation into the AccountInteractions concern, where we can: 1. create and persist model objects inside transactions without having to include job queuing inside the transaction 2. commonize the don't-add-a-blank-note check Finally, this commit resolves a invocation-on-nil in REST::RelationshipSerializer.
14 lines
392 B
Ruby
14 lines
392 B
Ruby
# frozen_string_literal: true
|
|
|
|
class MuteService < BaseService
|
|
def call(account, target_account, notifications: nil, note: nil)
|
|
return if account.id == target_account.id
|
|
|
|
ActiveRecord::Base.transaction do
|
|
mute = account.mute!(target_account, notifications: notifications, note: note)
|
|
BlockWorker.perform_async(account.id, target_account.id)
|
|
mute
|
|
end
|
|
end
|
|
end
|