Stop trying to shoehorn all Salmon updates into the poor database-connected
StreamEntry model. Simply render Salmon slaps as they are needed
This commit is contained in:
parent
94d2182717
commit
0518492158
22 changed files with 304 additions and 266 deletions
|
@ -1,12 +1,31 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UnblockService < BaseService
|
||||
include StreamEntryRenderer
|
||||
|
||||
def call(account, target_account)
|
||||
return unless account.blocking?(target_account)
|
||||
|
||||
unblock = account.unblock!(target_account)
|
||||
NotificationWorker.perform_async(stream_entry_to_xml(unblock.stream_entry), account.id, target_account.id) unless target_account.local?
|
||||
NotificationWorker.perform_async(build_xml(unblock), account.id, target_account.id) unless target_account.local?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build_xml(block)
|
||||
Nokogiri::XML::Builder.new do |xml|
|
||||
entry(xml, true) do
|
||||
title xml, "#{block.account.acct} no longer blocks #{block.target_account.acct}"
|
||||
|
||||
author(xml) do
|
||||
include_author xml, block.account
|
||||
end
|
||||
|
||||
object_type xml, :activity
|
||||
verb xml, :unblock
|
||||
|
||||
target(xml) do
|
||||
include_author xml, block.target_account
|
||||
end
|
||||
end
|
||||
end.to_xml
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue