Use to_json call for Relay enable/disable (#38232)
This commit is contained in:
@@ -31,7 +31,7 @@ class Relay < ApplicationRecord
|
|||||||
|
|
||||||
def enable!
|
def enable!
|
||||||
activity_id = ActivityPub::TagManager.instance.generate_uri_for(nil)
|
activity_id = ActivityPub::TagManager.instance.generate_uri_for(nil)
|
||||||
payload = Oj.dump(follow_activity(activity_id))
|
payload = follow_activity(activity_id).to_json
|
||||||
|
|
||||||
update!(state: :pending, follow_activity_id: activity_id)
|
update!(state: :pending, follow_activity_id: activity_id)
|
||||||
reset_delivery_tracker
|
reset_delivery_tracker
|
||||||
@@ -40,7 +40,7 @@ class Relay < ApplicationRecord
|
|||||||
|
|
||||||
def disable!
|
def disable!
|
||||||
activity_id = ActivityPub::TagManager.instance.generate_uri_for(nil)
|
activity_id = ActivityPub::TagManager.instance.generate_uri_for(nil)
|
||||||
payload = Oj.dump(unfollow_activity(activity_id))
|
payload = unfollow_activity(activity_id).to_json
|
||||||
|
|
||||||
update!(state: :idle, follow_activity_id: nil)
|
update!(state: :idle, follow_activity_id: nil)
|
||||||
reset_delivery_tracker
|
reset_delivery_tracker
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ RSpec.describe Relay do
|
|||||||
.to change { relay.reload.state }.to('idle')
|
.to change { relay.reload.state }.to('idle')
|
||||||
.and change { relay.reload.follow_activity_id }.to(be_nil)
|
.and change { relay.reload.follow_activity_id }.to(be_nil)
|
||||||
expect(ActivityPub::DeliveryWorker)
|
expect(ActivityPub::DeliveryWorker)
|
||||||
.to have_received(:perform_async).with(match('Undo'), Account.representative.id, relay.inbox_url)
|
.to have_received(:perform_async).with(match_json_values(type: 'Undo'), Account.representative.id, relay.inbox_url)
|
||||||
expect(DeliveryFailureTracker)
|
expect(DeliveryFailureTracker)
|
||||||
.to have_received(:reset!).with(relay.inbox_url)
|
.to have_received(:reset!).with(relay.inbox_url)
|
||||||
end
|
end
|
||||||
@@ -94,7 +94,7 @@ RSpec.describe Relay do
|
|||||||
.to change { relay.reload.state }.to('pending')
|
.to change { relay.reload.state }.to('pending')
|
||||||
.and change { relay.reload.follow_activity_id }.to(be_present)
|
.and change { relay.reload.follow_activity_id }.to(be_present)
|
||||||
expect(ActivityPub::DeliveryWorker)
|
expect(ActivityPub::DeliveryWorker)
|
||||||
.to have_received(:perform_async).with(match('Follow'), Account.representative.id, relay.inbox_url)
|
.to have_received(:perform_async).with(match_json_values(type: 'Follow'), Account.representative.id, relay.inbox_url)
|
||||||
expect(DeliveryFailureTracker)
|
expect(DeliveryFailureTracker)
|
||||||
.to have_received(:reset!).with(relay.inbox_url)
|
.to have_received(:reset!).with(relay.inbox_url)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user