about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-05-23 21:18:27 +0200
committerThibaut Girka <thib@sitedethib.com>2019-05-23 21:18:27 +0200
commitbf988123bad3c5341941376c946421c8e3fb4700 (patch)
treec4e8baef309e1fe08fccdd66bf6aa8de6f36fb97
parentc394d3cb25ad39f169fbf45d18153a51d34c43ad (diff)
parent9a5561a5b87e57fae0333a025b8ef42aaab6ce0f (diff)
Merge branch 'master' into glitch-soc/merge-upstream
-rw-r--r--app/lib/activitypub/activity/create.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 6b16c9986..2bc33c04b 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -267,7 +267,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
   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)
-    Conversation.find_by(uri: uri) || Conversation.create(uri: uri)
+    begin
+      Conversation.find_or_create_by!(uri: uri)
+    rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique
+      retry
+    end
   end
 
   def visibility_from_audience