about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2017-06-20 20:44:32 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-06-20 20:44:32 +0200
commit15b43f555dcb06742c677d84c25d05774ef1bde2 (patch)
treefd0875b8248e336a2f22f2cb1465a8f2a7c74caa /app/services
parentd8ec83280637e53ded67d4938a198cbeb9e8db05 (diff)
Fix conversations (fixes #3869) (#3870)
* Actually create conversations given explicit URIs

* Try to get the parent toot in before validation, to avoid creating a new conversation
Diffstat (limited to 'app/services')
-rw-r--r--app/services/process_feed_service.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index eabeb1799..fbdf92caa 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -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)