]> cat aescling's git repositories - mastodon.git/commitdiff
Add IDs to salmon slaps even if they are transient. Add title, too, mostly
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 13 Feb 2017 12:30:33 +0000 (13:30 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 13 Feb 2017 12:30:33 +0000 (13:30 +0100)
in case of debugging incoming salmons. Add <thr:in-reply-to /> to favourite
salmons because it seems to be required by GS.

app/services/authorize_follow_service.rb
app/services/block_service.rb
app/services/favourite_service.rb
app/services/follow_service.rb
app/services/reject_follow_service.rb
app/services/unblock_service.rb
app/services/unfavourite_service.rb
app/services/unfollow_service.rb

index 2e0b6d26cf1108c9779805b05680d8c19292e6d6..ac465bdb23c321ab4e196d4e14866b1ff4a19440 100644 (file)
@@ -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
index bcd8c44c414fe10ed9c9f47c3e5ab5e6cb2aa6c8..bd914d8be7e2cedea76d75253218fb0023dca1c1 100644 (file)
@@ -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
index 7038bc22270db73c989f6d4a0a3e8d2615703495..824729ed6d9037ce20f9629e3c2f4fa3f6ade918 100644 (file)
@@ -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
index 5a4250636f6b61b122ed4a7b7ac3593716d5809c..d67b1bf2d660a34e9172dbd0744d420e085fa339 100644 (file)
@@ -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
index ac92ad5f71fdc175f3470561ec5891a9e17b539c..1b03d62e645287b282add1ad7274ebfe2314b509 100644 (file)
@@ -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
index 4ff180747cfb256233464efc92deac88e3a19048..c4f789f742375e03b4bf9bfaee39ff992ecd8814 100644 (file)
@@ -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
index 7ad1778f623c30eac712e3e5f277f678ebc47780..1d3e6f06dd036c4401a3a77d75860a8f1dc61922 100644 (file)
@@ -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
index 8982b1c19e8f65e60a52d7dda4c208731f28bcfa..07f9b93ddce8caf07ea1a4453b355970c3abbe29 100644 (file)
@@ -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