From 8e08ae5bb91868d727fdd877aba0133744ad9934 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 13 Feb 2017 13:30:33 +0100 Subject: Add IDs to salmon slaps even if they are transient. Add title, too, mostly in case of debugging incoming salmons. Add to favourite salmons because it seems to be required by GS. --- app/services/authorize_follow_service.rb | 3 +++ app/services/block_service.rb | 1 + app/services/favourite_service.rb | 2 ++ app/services/follow_service.rb | 2 ++ app/services/reject_follow_service.rb | 3 +++ app/services/unblock_service.rb | 1 + app/services/unfavourite_service.rb | 2 ++ app/services/unfollow_service.rb | 1 + 8 files changed, 15 insertions(+) diff --git a/app/services/authorize_follow_service.rb b/app/services/authorize_follow_service.rb index 2e0b6d26c..ac465bdb2 100644 --- a/app/services/authorize_follow_service.rb +++ b/app/services/authorize_follow_service.rb @@ -12,6 +12,9 @@ class AuthorizeFollowService < BaseService def build_xml(follow_request) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, Time.now.utc, follow_request.id, 'FollowRequest' + title xml, "#{follow_request.target_account.acct} authorizes follow request by #{follow_request.account.acct}" + author(xml) do include_author xml, follow_request.target_account end diff --git a/app/services/block_service.rb b/app/services/block_service.rb index bcd8c44c4..bd914d8be 100644 --- a/app/services/block_service.rb +++ b/app/services/block_service.rb @@ -20,6 +20,7 @@ class BlockService < BaseService def build_xml(block) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, block.created_at, block.id, 'Block' title xml, "#{block.account.acct} no longer wishes to interact with #{block.target_account.acct}" author(xml) do diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb index 7038bc222..824729ed6 100644 --- a/app/services/favourite_service.rb +++ b/app/services/favourite_service.rb @@ -24,6 +24,7 @@ class FavouriteService < BaseService def build_xml(favourite) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, favourite.created_at, favourite.id, 'Favourite' title xml, "#{favourite.account.acct} favourited a status by #{favourite.status.account.acct}" author(xml) do @@ -32,6 +33,7 @@ class FavouriteService < BaseService object_type xml, :activity verb xml, :favorite + in_reply_to xml, TagManager.instance.uri_for(favourite.status), TagManager.instance.url_for(favourite.status) target(xml) do include_target xml, favourite.status diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index 5a4250636..d67b1bf2d 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -57,6 +57,7 @@ class FollowService < BaseService def build_follow_request_xml(follow_request) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, follow_request.created_at, follow_request.id, 'FollowRequest' title xml, "#{follow_request.account.acct} requested to follow #{follow_request.target_account.acct}" author(xml) do @@ -76,6 +77,7 @@ class FollowService < BaseService def build_follow_xml(follow) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, follow.created_at, follow.id, 'Follow' title xml, "#{follow.account.acct} started following #{follow.target_account.acct}" author(xml) do diff --git a/app/services/reject_follow_service.rb b/app/services/reject_follow_service.rb index ac92ad5f7..1b03d62e6 100644 --- a/app/services/reject_follow_service.rb +++ b/app/services/reject_follow_service.rb @@ -12,6 +12,9 @@ class RejectFollowService < BaseService def build_xml(follow_request) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, Time.now.utc, follow_request.id, 'FollowRequest' + title xml, "#{follow_request.target_account.acct} rejects follow request by #{follow_request.account.acct}" + author(xml) do include_author xml, follow_request.target_account end diff --git a/app/services/unblock_service.rb b/app/services/unblock_service.rb index 4ff180747..c4f789f74 100644 --- a/app/services/unblock_service.rb +++ b/app/services/unblock_service.rb @@ -13,6 +13,7 @@ class UnblockService < BaseService def build_xml(block) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, Time.now.utc, block.id, 'Block' title xml, "#{block.account.acct} no longer blocks #{block.target_account.acct}" author(xml) do diff --git a/app/services/unfavourite_service.rb b/app/services/unfavourite_service.rb index 7ad1778f6..1d3e6f06d 100644 --- a/app/services/unfavourite_service.rb +++ b/app/services/unfavourite_service.rb @@ -15,6 +15,7 @@ class UnfavouriteService < BaseService def build_xml(favourite) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, Time.now.utc, favourite.id, 'Favourite' title xml, "#{favourite.account.acct} no longer favourites a status by #{favourite.status.account.acct}" author(xml) do @@ -23,6 +24,7 @@ class UnfavouriteService < BaseService object_type xml, :activity verb xml, :unfavorite + in_reply_to xml, TagManager.instance.uri_for(favourite.status), TagManager.instance.url_for(favourite.status) target(xml) do include_target xml, favourite.status diff --git a/app/services/unfollow_service.rb b/app/services/unfollow_service.rb index 8982b1c19..07f9b93dd 100644 --- a/app/services/unfollow_service.rb +++ b/app/services/unfollow_service.rb @@ -15,6 +15,7 @@ class UnfollowService < BaseService def build_xml(follow) Nokogiri::XML::Builder.new do |xml| entry(xml, true) do + unique_id xml, Time.now.utc, follow.id, 'Follow' title xml, "#{follow.account.acct} is no longer following #{follow.target_account.acct}" author(xml) do -- cgit