about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-10-14 21:42:09 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-10-14 14:42:09 +0200
commit8125fdc19f310a22fdd1395365c2f02d6887b389 (patch)
tree7d85e55d35e6b0b40de87058e449bfe6dd43b860 /app
parentae716a12e1604a4df54acbc77ff35f591e3168e2 (diff)
Use atomUri in Undo activity of Announce (#5376)
This allows deletion of reblogs which delivered before with OStatus URI.
Diffstat (limited to 'app')
-rw-r--r--app/lib/activitypub/activity/undo.rb3
-rw-r--r--app/serializers/activitypub/activity_serializer.rb5
2 files changed, 7 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity/undo.rb b/app/lib/activitypub/activity/undo.rb
index 4b0905de2..cbed417c4 100644
--- a/app/lib/activitypub/activity/undo.rb
+++ b/app/lib/activitypub/activity/undo.rb
@@ -17,7 +17,8 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity
   private
 
   def undo_announce
-    status = Status.find_by(uri: object_uri, account: @account)
+    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)
diff --git a/app/serializers/activitypub/activity_serializer.rb b/app/serializers/activitypub/activity_serializer.rb
index df399211c..50c4f6a04 100644
--- a/app/serializers/activitypub/activity_serializer.rb
+++ b/app/serializers/activitypub/activity_serializer.rb
@@ -5,6 +5,7 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
 
   has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, unless: :announce?
   attribute :proper_uri, key: :object, if: :announce?
+  attribute :atom_uri, if: :announce?
 
   def id
     ActivityPub::TagManager.instance.activity_uri_for(object)
@@ -34,6 +35,10 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
     ActivityPub::TagManager.instance.uri_for(object.proper)
   end
 
+  def atom_uri
+    OStatus::TagManager.instance.uri_for(object)
+  end
+
   def announce?
     object.reblog?
   end