about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-09-01 21:12:59 +0200
committerGitHub <noreply@github.com>2017-09-01 21:12:59 +0200
commitc2980d5b17d355985a6d5ac4eaa12371463363b3 (patch)
tree34b3b4881293caee3a5b26c927a24c4dd2d3f1a9 /app/lib
parenta75aa62f5bd410e07ecf295248dc932fe2714c00 (diff)
Do not rely on activity arriving exactly once after delete arrived (#4754)
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/activitypub/activity.rb9
-rw-r--r--app/lib/activitypub/activity/delete.rb12
2 files changed, 7 insertions, 14 deletions
diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb
index 14e3ca784..b06dd6194 100644
--- a/app/lib/activitypub/activity.rb
+++ b/app/lib/activitypub/activity.rb
@@ -97,14 +97,7 @@ class ActivityPub::Activity
   end
 
   def delete_arrived_first?(uri)
-    key = "delete_upon_arrival:#{@account.id}:#{uri}"
-
-    if redis.exists(key)
-      redis.del(key)
-      true
-    else
-      false
-    end
+    redis.exists("delete_upon_arrival:#{@account.id}:#{uri}")
   end
 
   def delete_later!(uri)
diff --git a/app/lib/activitypub/activity/delete.rb b/app/lib/activitypub/activity/delete.rb
index afa9a8079..767909fb1 100644
--- a/app/lib/activitypub/activity/delete.rb
+++ b/app/lib/activitypub/activity/delete.rb
@@ -5,12 +5,12 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
     status   = Status.find_by(uri: object_uri, account: @account)
     status ||= Status.find_by(uri: @object['_:atomUri'], account: @account) if @object.is_a?(Hash) && @object['_:atomUri'].present?
 
-    if status.nil?
-      delete_later!(object_uri)
-    else
-      forward_for_reblogs(status)
-      delete_now!(status)
-    end
+    delete_later!(object_uri)
+
+    return if status.nil?
+
+    forward_for_reblogs(status)
+    delete_now!(status)
   end
 
   private