mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-04 03:25:14 +00:00
Add API endpoints to view and revoke one's quoted posts (#35578)
This commit is contained in:
parent
572a0e128d
commit
2dfdcc7dcb
10 changed files with 324 additions and 0 deletions
32
app/services/revoke_quote_service.rb
Normal file
32
app/services/revoke_quote_service.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RevokeQuoteService < BaseService
|
||||
include Payloadable
|
||||
|
||||
def call(quote)
|
||||
@quote = quote
|
||||
@account = quote.quoted_account
|
||||
|
||||
@quote.reject!
|
||||
distribute_stamp_deletion!
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def distribute_stamp_deletion!
|
||||
ActivityPub::DeliveryWorker.push_bulk(inboxes, limit: 1_000) do |inbox_url|
|
||||
[signed_activity_json, @account.id, inbox_url]
|
||||
end
|
||||
end
|
||||
|
||||
def inboxes
|
||||
[
|
||||
@quote.status,
|
||||
@quote.quoted_status,
|
||||
].compact.map { |status| StatusReachFinder.new(status, unsafe: true).inboxes }.flatten.uniq
|
||||
end
|
||||
|
||||
def signed_activity_json
|
||||
@signed_activity_json ||= Oj.dump(serialize_payload(@quote, ActivityPub::DeleteQuoteAuthorizationSerializer, signer: @account, always_sign: true))
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue