about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-08-17 21:35:00 +0200
committerGitHub <noreply@github.com>2017-08-17 21:35:00 +0200
commitad892dbc0c377d82b2cae349f189a41708a1e6af (patch)
tree6d8754d5a1d2648f4a2d9355dfbe64b5cf5b7942 /app/lib
parent075d6a1e13aa6477c656e9dbe03e6720cb4e2b32 (diff)
Add _:atomUri property for deduplicating OStatus/ActivityPub legacy records (#4593)
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/activitypub/activity/create.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 4c4049bc6..de9c47d5c 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -4,7 +4,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
   def perform
     return if delete_arrived_first?(object_uri) || unsupported_object_type?
 
-    status = Status.find_by(uri: object_uri)
+    status = find_existing_status
 
     return status unless status.nil?
 
@@ -23,6 +23,12 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
 
   private
 
+  def find_existing_status
+    status   = Status.find_by(uri: object_uri)
+    status ||= Status.find_by(uri: @object['_:atomUri']) if @object['_:atomUri'].present?
+    status
+  end
+
   def status_params
     {
       uri: @object['id'],