Add IDs to salmon slaps even if they are transient. Add title, too, mostly

in case of debugging incoming salmons. Add <thr:in-reply-to /> to favourite
salmons because it seems to be required by GS.
This commit is contained in:
Eugen Rochko 2017-02-13 13:30:33 +01:00
parent df63461ff0
commit 8e08ae5bb9
8 changed files with 15 additions and 0 deletions

View File

@ -12,6 +12,9 @@ class AuthorizeFollowService < BaseService
def build_xml(follow_request) def build_xml(follow_request)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do 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 author(xml) do
include_author xml, follow_request.target_account include_author xml, follow_request.target_account
end end

View File

@ -20,6 +20,7 @@ class BlockService < BaseService
def build_xml(block) def build_xml(block)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do 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}" title xml, "#{block.account.acct} no longer wishes to interact with #{block.target_account.acct}"
author(xml) do author(xml) do

View File

@ -24,6 +24,7 @@ class FavouriteService < BaseService
def build_xml(favourite) def build_xml(favourite)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do 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}" title xml, "#{favourite.account.acct} favourited a status by #{favourite.status.account.acct}"
author(xml) do author(xml) do
@ -32,6 +33,7 @@ class FavouriteService < BaseService
object_type xml, :activity object_type xml, :activity
verb xml, :favorite verb xml, :favorite
in_reply_to xml, TagManager.instance.uri_for(favourite.status), TagManager.instance.url_for(favourite.status)
target(xml) do target(xml) do
include_target xml, favourite.status include_target xml, favourite.status

View File

@ -57,6 +57,7 @@ class FollowService < BaseService
def build_follow_request_xml(follow_request) def build_follow_request_xml(follow_request)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do 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}" title xml, "#{follow_request.account.acct} requested to follow #{follow_request.target_account.acct}"
author(xml) do author(xml) do
@ -76,6 +77,7 @@ class FollowService < BaseService
def build_follow_xml(follow) def build_follow_xml(follow)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do entry(xml, true) do
unique_id xml, follow.created_at, follow.id, 'Follow'
title xml, "#{follow.account.acct} started following #{follow.target_account.acct}" title xml, "#{follow.account.acct} started following #{follow.target_account.acct}"
author(xml) do author(xml) do

View File

@ -12,6 +12,9 @@ class RejectFollowService < BaseService
def build_xml(follow_request) def build_xml(follow_request)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do 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 author(xml) do
include_author xml, follow_request.target_account include_author xml, follow_request.target_account
end end

View File

@ -13,6 +13,7 @@ class UnblockService < BaseService
def build_xml(block) def build_xml(block)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do 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}" title xml, "#{block.account.acct} no longer blocks #{block.target_account.acct}"
author(xml) do author(xml) do

View File

@ -15,6 +15,7 @@ class UnfavouriteService < BaseService
def build_xml(favourite) def build_xml(favourite)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do 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}" title xml, "#{favourite.account.acct} no longer favourites a status by #{favourite.status.account.acct}"
author(xml) do author(xml) do
@ -23,6 +24,7 @@ class UnfavouriteService < BaseService
object_type xml, :activity object_type xml, :activity
verb xml, :unfavorite verb xml, :unfavorite
in_reply_to xml, TagManager.instance.uri_for(favourite.status), TagManager.instance.url_for(favourite.status)
target(xml) do target(xml) do
include_target xml, favourite.status include_target xml, favourite.status

View File

@ -15,6 +15,7 @@ class UnfollowService < BaseService
def build_xml(follow) def build_xml(follow)
Nokogiri::XML::Builder.new do |xml| Nokogiri::XML::Builder.new do |xml|
entry(xml, true) do 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}" title xml, "#{follow.account.acct} is no longer following #{follow.target_account.acct}"
author(xml) do author(xml) do