about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/lib/activitypub/activity/create.rb11
-rw-r--r--app/models/conversation.rb7
-rw-r--r--app/serializers/activitypub/note_serializer.rb15
3 files changed, 2 insertions, 31 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 000b77df5..eb7b09e44 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -67,7 +67,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
         sensitive: @object['sensitive'] || false,
         visibility: visibility_from_audience,
         thread: replied_to_status,
-        conversation: conversation_from_uri(@object['conversation']),
         media_attachment_ids: process_attachments.take(4).map(&:id),
         poll: process_poll,
       }
@@ -262,16 +261,6 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
     ActivityPub::FetchRepliesWorker.perform_async(status.id, uri) unless uri.nil?
   end
 
-  def conversation_from_uri(uri)
-    return nil if uri.nil?
-    return Conversation.find_by(id: OStatus::TagManager.instance.unique_tag_to_local_id(uri, 'Conversation')) if OStatus::TagManager.instance.local_id?(uri)
-    begin
-      Conversation.find_or_create_by!(uri: uri)
-    rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique
-      retry
-    end
-  end
-
   def visibility_from_audience
     if equals_or_includes?(@object['to'], ActivityPub::TagManager::COLLECTIONS[:public])
       :public
diff --git a/app/models/conversation.rb b/app/models/conversation.rb
index 4dfaea889..37d233f32 100644
--- a/app/models/conversation.rb
+++ b/app/models/conversation.rb
@@ -4,17 +4,10 @@
 # Table name: conversations
 #
 #  id         :bigint(8)        not null, primary key
-#  uri        :string
 #  created_at :datetime         not null
 #  updated_at :datetime         not null
 #
 
 class Conversation < ApplicationRecord
-  validates :uri, uniqueness: true, if: :uri?
-
   has_many :statuses
-
-  def local?
-    uri.nil?
-  end
 end
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb
index 67f596e78..88b50b3ea 100644
--- a/app/serializers/activitypub/note_serializer.rb
+++ b/app/serializers/activitypub/note_serializer.rb
@@ -1,14 +1,13 @@
 # frozen_string_literal: true
 
 class ActivityPub::NoteSerializer < ActivityPub::Serializer
-  context_extensions :atom_uri, :conversation, :sensitive,
+  context_extensions :atom_uri, :sensitive,
                      :hashtag, :emoji, :focal_point, :blurhash
 
   attributes :id, :type, :summary,
              :in_reply_to, :published, :url,
              :attributed_to, :to, :cc, :sensitive,
-             :atom_uri, :in_reply_to_atom_uri,
-             :conversation
+             :atom_uri, :in_reply_to_atom_uri
 
   attribute :content
   attribute :content_map, if: :language?
@@ -110,16 +109,6 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
     OStatus::TagManager.instance.uri_for(object.thread)
   end
 
-  def conversation
-    return if object.conversation.nil?
-
-    if object.conversation.uri?
-      object.conversation.uri
-    else
-      OStatus::TagManager.instance.unique_tag(object.conversation.created_at, object.conversation.id, 'Conversation')
-    end
-  end
-
   def local?
     object.account.local?
   end