diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-08-29 16:11:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-29 16:11:05 +0200 |
commit | 4c76402ba1d355061e7e208b7a2f8251388a38e1 (patch) | |
tree | f76f71be7326e16ccaeaf74402f36c79973b734b /app/lib/ostatus | |
parent | 9958eba356210f1d0b89db368e17bbd72358e097 (diff) |
Serialize ActivityPub alternate link into OStatus deletes, handle it (#4730)
Requires moving Atom rendering from DistributionWorker (where `stream_entry.status` is already nil) to inline (where `stream_entry.status.destroyed?` is true) and distributing that. Unfortunately, such XML renderings can no longer be easily chained together into one payload of n items.
Diffstat (limited to 'app/lib/ostatus')
-rw-r--r-- | app/lib/ostatus/activity/deletion.rb | 4 | ||||
-rw-r--r-- | app/lib/ostatus/atom_serializer.rb | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/app/lib/ostatus/activity/deletion.rb b/app/lib/ostatus/activity/deletion.rb index 860faf501..c98f5ee0a 100644 --- a/app/lib/ostatus/activity/deletion.rb +++ b/app/lib/ostatus/activity/deletion.rb @@ -3,7 +3,9 @@ class OStatus::Activity::Deletion < OStatus::Activity::Base def perform Rails.logger.debug "Deleting remote status #{id}" - status = Status.find_by(uri: id, account: @account) + + status = Status.find_by(uri: id, account: @account) + status ||= Status.find_by(uri: activitypub_uri, account: @account) if activitypub_uri? if status.nil? redis.setex("delete_upon_arrival:#{@account.id}:#{id}", 6 * 3_600, id) diff --git a/app/lib/ostatus/atom_serializer.rb b/app/lib/ostatus/atom_serializer.rb index 92a16d228..81fae4140 100644 --- a/app/lib/ostatus/atom_serializer.rb +++ b/app/lib/ostatus/atom_serializer.rb @@ -79,6 +79,9 @@ class OStatus::AtomSerializer if stream_entry.status.nil? append_element(entry, 'content', 'Deleted status') + elsif stream_entry.status.destroyed? + append_element(entry, 'content', 'Deleted status') + append_element(entry, 'link', nil, rel: :alternate, type: 'application/activity+json', href: ActivityPub::TagManager.instance.uri_for(stream_entry.status)) if stream_entry.account.local? else serialize_status_attributes(entry, stream_entry.status) end |