]> cat aescling's git repositories - mastodon.git/commitdiff
Fix conversations (fixes #3869) (#3870)
authorThibG <thib@sitedethib.com>
Tue, 20 Jun 2017 18:44:32 +0000 (20:44 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 20 Jun 2017 18:44:32 +0000 (20:44 +0200)
* Actually create conversations given explicit URIs

* Try to get the parent toot in before validation, to avoid creating a new conversation

app/services/process_feed_service.rb

index eabeb1799ad5d446724364a5c3a7e5ed0c617add..fbdf92caab72127c5c7bc4b69aa684de0bae6960 100644 (file)
@@ -66,8 +66,6 @@ class ProcessFeedService < BaseService
           status.reblog = original_status.reblog? ? original_status.reblog : original_status
         end
 
-        status.thread = find_status(thread(@xml).first) if thread?(@xml)
-
         status.save!
       end
 
@@ -155,7 +153,8 @@ class ProcessFeedService < BaseService
         reply: thread?(entry),
         language: content_language(entry),
         visibility: visibility_scope(entry),
-        conversation: find_or_create_conversation(entry)
+        conversation: find_or_create_conversation(entry),
+        thread: thread?(entry) ? find_status(thread(entry).first) : nil
       )
 
       mentions_from_xml(status, entry)
@@ -174,7 +173,7 @@ class ProcessFeedService < BaseService
         return Conversation.find_by(id: local_id)
       end
 
-      Conversation.find_by(uri: uri)
+      Conversation.find_by(uri: uri) || Conversation.create!(uri: uri)
     end
 
     def find_status(uri)