mirror of https://github.com/tootsuite/mastodon
Drop support for `atomUri` and `inReplyToAtomUri`
parent
00cb4a0313
commit
d3e0eb8c00
|
@ -15,8 +15,7 @@ module ContextHelper
|
|||
emoji: { 'toot' => 'http://joinmastodon.org/ns#', 'Emoji' => 'toot:Emoji' },
|
||||
featured: { 'toot' => 'http://joinmastodon.org/ns#', 'featured' => { '@id' => 'toot:featured', '@type' => '@id' }, 'featuredTags' => { '@id' => 'toot:featuredTags', '@type' => '@id' } },
|
||||
property_value: { 'schema' => 'http://schema.org#', 'PropertyValue' => 'schema:PropertyValue', 'value' => 'schema:value' },
|
||||
atom_uri: { 'ostatus' => 'http://ostatus.org#', 'atomUri' => 'ostatus:atomUri' },
|
||||
conversation: { 'ostatus' => 'http://ostatus.org#', 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri', 'conversation' => 'ostatus:conversation' },
|
||||
conversation: { 'ostatus' => 'http://ostatus.org#', 'conversation' => 'ostatus:conversation' },
|
||||
focal_point: { 'toot' => 'http://joinmastodon.org/ns#', 'focalPoint' => { '@container' => '@list', '@id' => 'toot:focalPoint' } },
|
||||
blurhash: { 'toot' => 'http://joinmastodon.org/ns#', 'blurhash' => 'toot:blurhash' },
|
||||
discoverable: { 'toot' => 'http://joinmastodon.org/ns#', 'discoverable' => 'toot:discoverable' },
|
||||
|
|
|
@ -103,7 +103,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
|
||||
def find_existing_status
|
||||
status = status_from_uri(object_uri)
|
||||
status ||= Status.find_by(uri: @object['atomUri']) if @object['atomUri'].present?
|
||||
status if status&.account_id == @account.id
|
||||
end
|
||||
|
||||
|
@ -363,7 +362,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
@replied_to_status = nil
|
||||
else
|
||||
@replied_to_status = status_from_uri(in_reply_to_uri)
|
||||
@replied_to_status ||= status_from_uri(@object['inReplyToAtomUri']) if @object['inReplyToAtomUri'].present?
|
||||
@replied_to_status
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,8 +33,6 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
|
|||
end
|
||||
|
||||
@status = Status.find_by(uri: object_uri, account: @account)
|
||||
@status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present?
|
||||
|
||||
return if @status.nil?
|
||||
|
||||
forwarder.forward! if forwarder.forwardable?
|
||||
|
|
|
@ -73,7 +73,6 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
|
|||
return if object_uri.nil?
|
||||
|
||||
status = Status.find_by(uri: object_uri, account: @account)
|
||||
status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present?
|
||||
|
||||
if status.nil?
|
||||
delete_later!(object_uri)
|
||||
|
|
|
@ -179,8 +179,6 @@ class ActivityPub::TagManager
|
|||
else
|
||||
StatusFinder.new(uri).status
|
||||
end
|
||||
elsif OStatus::TagManager.instance.local_id?(uri)
|
||||
klass.find_by(id: OStatus::TagManager.instance.unique_tag_to_local_id(uri, klass.to_s))
|
||||
else
|
||||
klass.find_by(uri: uri.split('#').first)
|
||||
end
|
||||
|
|
|
@ -59,15 +59,4 @@ class OStatus::TagManager
|
|||
def local_id?(id)
|
||||
id.start_with?("tag:#{Rails.configuration.x.local_domain}") || ActivityPub::TagManager.instance.local_uri?(id)
|
||||
end
|
||||
|
||||
def uri_for(target)
|
||||
return target.uri if target.respond_to?(:local?) && !target.local?
|
||||
|
||||
case target.object_type
|
||||
when :person
|
||||
account_url(target)
|
||||
when :note, :comment, :activity
|
||||
target.uri || unique_tag(target.created_at, target.id, 'Status')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
class ActivityPub::DeleteSerializer < ActivityPub::Serializer
|
||||
class TombstoneSerializer < ActivityPub::Serializer
|
||||
context_extensions :atom_uri
|
||||
|
||||
attributes :id, :type, :atom_uri
|
||||
attributes :id, :type
|
||||
|
||||
def id
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
|
@ -13,10 +11,6 @@ class ActivityPub::DeleteSerializer < ActivityPub::Serializer
|
|||
def type
|
||||
'Tombstone'
|
||||
end
|
||||
|
||||
def atom_uri
|
||||
OStatus::TagManager.instance.uri_for(object)
|
||||
end
|
||||
end
|
||||
|
||||
attributes :id, :type, :actor, :to
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
||||
include FormattingHelper
|
||||
|
||||
context_extensions :atom_uri, :conversation, :sensitive, :voters_count
|
||||
context_extensions :conversation, :sensitive, :voters_count
|
||||
|
||||
attributes :id, :type, :summary,
|
||||
:in_reply_to, :published, :url,
|
||||
:attributed_to, :to, :cc, :sensitive,
|
||||
:atom_uri, :in_reply_to_atom_uri,
|
||||
:conversation
|
||||
|
||||
attribute :content
|
||||
|
@ -116,18 +115,6 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
|
|||
object.active_mentions.to_a.sort_by(&:id) + object.tags + object.emojis
|
||||
end
|
||||
|
||||
def atom_uri
|
||||
return unless object.local?
|
||||
|
||||
OStatus::TagManager.instance.uri_for(object)
|
||||
end
|
||||
|
||||
def in_reply_to_atom_uri
|
||||
return unless object.reply? && !object.thread.nil?
|
||||
|
||||
OStatus::TagManager.instance.uri_for(object.thread)
|
||||
end
|
||||
|
||||
def conversation
|
||||
return if object.conversation.nil?
|
||||
|
||||
|
|
|
@ -27,11 +27,10 @@ RSpec.describe ActivityPub::Activity::Undo do
|
|||
type: 'Announce',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: ActivityPub::TagManager.instance.uri_for(status),
|
||||
atomUri: 'barbar',
|
||||
}
|
||||
end
|
||||
|
||||
context 'when not atomUri' do
|
||||
context 'when embedded object' do
|
||||
before do
|
||||
Fabricate(:status, reblog: status, account: sender, uri: 'bar')
|
||||
end
|
||||
|
@ -42,17 +41,6 @@ RSpec.describe ActivityPub::Activity::Undo do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with atomUri' do
|
||||
before do
|
||||
Fabricate(:status, reblog: status, account: sender, uri: 'barbar')
|
||||
end
|
||||
|
||||
it 'deletes the reblog by atomUri' do
|
||||
subject.perform
|
||||
expect(sender.reblogged?(status)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'with only object uri' do
|
||||
let(:object_json) { 'bar' }
|
||||
|
||||
|
|
|
@ -170,11 +170,6 @@ RSpec.describe ActivityPub::TagManager do
|
|||
expect(subject.uri_to_resource(subject.uri_for(status), Status)).to eq status
|
||||
end
|
||||
|
||||
it 'returns the local status for OStatus tag: URI' do
|
||||
status = Fabricate(:status)
|
||||
expect(subject.uri_to_resource(OStatus::TagManager.instance.uri_for(status), Status)).to eq status
|
||||
end
|
||||
|
||||
it 'returns the remote status by matching URI without fragment part' do
|
||||
status = Fabricate(:status, uri: 'https://example.com/123')
|
||||
expect(subject.uri_to_resource('https://example.com/123#456', Status)).to eq status
|
||||
|
|
|
@ -36,35 +36,4 @@ describe OStatus::TagManager do
|
|||
expect(described_class.instance.local_id?('tag:foreign.tld;objectId=12:objectType=Status')).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe '#uri_for' do
|
||||
subject { described_class.instance.uri_for(target) }
|
||||
|
||||
context 'with comment object' do
|
||||
let(:target) { Fabricate(:status, created_at: '2000-01-01T00:00:00Z', reply: true) }
|
||||
|
||||
it 'returns the unique tag for status' do
|
||||
expect(target.object_type).to eq :comment
|
||||
expect(subject).to eq target.uri
|
||||
end
|
||||
end
|
||||
|
||||
context 'with note object' do
|
||||
let(:target) { Fabricate(:status, created_at: '2000-01-01T00:00:00Z', reply: false, thread: nil) }
|
||||
|
||||
it 'returns the unique tag for status' do
|
||||
expect(target.object_type).to eq :note
|
||||
expect(subject).to eq target.uri
|
||||
end
|
||||
end
|
||||
|
||||
context 'when person object' do
|
||||
let(:target) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
it 'returns the URL for account' do
|
||||
expect(target.object_type).to eq :person
|
||||
expect(subject).to eq 'https://cb6e6126.ngrok.io/users/alice'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,7 +77,6 @@ RSpec.describe RemoveStatusService, :inline_jobs do
|
|||
'object' => {
|
||||
'type' => 'Tombstone',
|
||||
'id' => ActivityPub::TagManager.instance.uri_for(status),
|
||||
'atomUri' => OStatus::TagManager.instance.uri_for(status),
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue