mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-20 09:13:18 +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
26
spec/services/revoke_quote_service_spec.rb
Normal file
26
spec/services/revoke_quote_service_spec.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe RevokeQuoteService do
|
||||
subject { described_class.new }
|
||||
|
||||
let!(:alice) { Fabricate(:account) }
|
||||
let!(:hank) { Fabricate(:account, username: 'hank', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
|
||||
|
||||
let(:status) { Fabricate(:status, account: alice) }
|
||||
|
||||
let(:quote) { Fabricate(:quote, quoted_status: status, state: :accepted, approval_uri: "https://#{Rails.configuration.x.web_domain}/approvals/1234") }
|
||||
|
||||
before do
|
||||
hank.follow!(alice)
|
||||
end
|
||||
|
||||
context 'with an accepted quote' do
|
||||
it 'revokes the quote and sends a Delete activity' do
|
||||
expect { described_class.new.call(quote) }
|
||||
.to change { quote.reload.state }.from('accepted').to('revoked')
|
||||
.and enqueue_sidekiq_job(ActivityPub::DeliveryWorker).with(/Delete/, alice.id, hank.inbox_url)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue