diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index 86432863175..3f8c59df8e9 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -58,7 +58,7 @@ class ActivityPub::TagManager account_url(username: username) end - def generate_uri_for(_target) + def generate_activity_uri URI.join(root_url, 'payloads', SecureRandom.uuid) end diff --git a/app/models/concerns/activitypub_payload_generation.rb b/app/models/concerns/activitypub_payload_generation.rb index 372b282a08a..51c7070caa4 100644 --- a/app/models/concerns/activitypub_payload_generation.rb +++ b/app/models/concerns/activitypub_payload_generation.rb @@ -14,6 +14,6 @@ module ActivityPubPayloadGeneration def generate_payload_uri self.uri = ActivityPub::TagManager .instance - .generate_uri_for(self) + .generate_activity_uri end end diff --git a/app/models/relay.rb b/app/models/relay.rb index f652b4864b6..d8f388e869e 100644 --- a/app/models/relay.rb +++ b/app/models/relay.rb @@ -26,7 +26,7 @@ class Relay < ApplicationRecord alias enabled? accepted? def enable! - activity_id = ActivityPub::TagManager.instance.generate_uri_for(nil) + activity_id = ActivityPub::TagManager.instance.generate_activity_uri payload = Oj.dump(follow_activity(activity_id)) update!(state: :pending, follow_activity_id: activity_id) @@ -35,7 +35,7 @@ class Relay < ApplicationRecord end def disable! - activity_id = ActivityPub::TagManager.instance.generate_uri_for(nil) + activity_id = ActivityPub::TagManager.instance.generate_activity_uri payload = Oj.dump(unfollow_activity(activity_id)) update!(state: :idle, follow_activity_id: nil) diff --git a/app/models/report.rb b/app/models/report.rb index 17c1503436f..9b28ce35c37 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -162,7 +162,7 @@ class Report < ApplicationRecord private def set_uri - self.uri = ActivityPub::TagManager.instance.generate_uri_for(self) if uri.nil? && account.local? + self.uri = ActivityPub::TagManager.instance.generate_activity_uri if uri.nil? && account.local? end def validate_rule_ids diff --git a/app/presenters/activitypub/activity_presenter.rb b/app/presenters/activitypub/activity_presenter.rb index 38e8527e8e5..f7e44fa6931 100644 --- a/app/presenters/activitypub/activity_presenter.rb +++ b/app/presenters/activitypub/activity_presenter.rb @@ -29,7 +29,7 @@ class ActivityPub::ActivityPresenter < ActiveModelSerializers::Model def from_encrypted_message(encrypted_message) new.tap do |presenter| - presenter.id = ActivityPub::TagManager.instance.generate_uri_for(nil) + presenter.id = ActivityPub::TagManager.instance.generate_activity_uri presenter.type = 'Create' presenter.actor = ActivityPub::TagManager.instance.uri_for(encrypted_message.source_account) presenter.published = Time.now.utc