mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
Always give local quote of remote posts a quote request URI (#35383)
This commit is contained in:
parent
5bbc3c5ebb
commit
c0eabe289b
|
@ -31,7 +31,7 @@ class Quote < ApplicationRecord
|
|||
belongs_to :quoted_account, class_name: 'Account', optional: true
|
||||
|
||||
before_validation :set_accounts
|
||||
|
||||
before_validation :set_activity_uri, only: :create, if: -> { account.local? && quoted_account&.remote? }
|
||||
validates :activity_uri, presence: true, if: -> { account.local? && quoted_account&.remote? }
|
||||
validate :validate_visibility
|
||||
|
||||
|
@ -69,4 +69,8 @@ class Quote < ApplicationRecord
|
|||
|
||||
errors.add(:quoted_status_id, :visibility_mismatch)
|
||||
end
|
||||
|
||||
def set_activity_uri
|
||||
self.activity_uri = [ActivityPub::TagManager.instance.uri_for(account), '/quote_requests/', SecureRandom.uuid].join
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class ActivityPub::QuoteRequestSerializer < ActivityPub::Serializer
|
|||
attribute :virtual_object, key: :object
|
||||
|
||||
def id
|
||||
object.activity_uri || [ActivityPub::TagManager.instance.uri_for(object.target_account), '#quote_requests/', object.id].join
|
||||
object.activity_uri
|
||||
end
|
||||
|
||||
def type
|
||||
|
|
Loading…
Reference in New Issue
Block a user