Commit 8e08ae5b authored by Eugen Rochko's avatar Eugen Rochko

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.
parent df63461f
...@@ -12,6 +12,9 @@ class AuthorizeFollowService < BaseService ...@@ -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
......
...@@ -20,6 +20,7 @@ class BlockService < BaseService ...@@ -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
......
...@@ -24,6 +24,7 @@ class FavouriteService < BaseService ...@@ -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 ...@@ -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
......
...@@ -57,6 +57,7 @@ class FollowService < BaseService ...@@ -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 ...@@ -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
......
...@@ -12,6 +12,9 @@ class RejectFollowService < BaseService ...@@ -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
......
...@@ -13,6 +13,7 @@ class UnblockService < BaseService ...@@ -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
......
...@@ -15,6 +15,7 @@ class UnfavouriteService < BaseService ...@@ -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 ...@@ -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
......
...@@ -15,6 +15,7 @@ class UnfollowService < BaseService ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment