Browse Source

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.
master
Eugen Rochko 7 years ago
parent
commit
8e08ae5bb9
8 changed files with 15 additions and 0 deletions
  1. +3
    -0
      app/services/authorize_follow_service.rb
  2. +1
    -0
      app/services/block_service.rb
  3. +2
    -0
      app/services/favourite_service.rb
  4. +2
    -0
      app/services/follow_service.rb
  5. +3
    -0
      app/services/reject_follow_service.rb
  6. +1
    -0
      app/services/unblock_service.rb
  7. +2
    -0
      app/services/unfavourite_service.rb
  8. +1
    -0
      app/services/unfollow_service.rb

+ 3
- 0
app/services/authorize_follow_service.rb 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

+ 1
- 0
app/services/block_service.rb 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

+ 2
- 0
app/services/favourite_service.rb 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

+ 2
- 0
app/services/follow_service.rb 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

+ 3
- 0
app/services/reject_follow_service.rb 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

+ 1
- 0
app/services/unblock_service.rb 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

+ 2
- 0
app/services/unfavourite_service.rb 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

+ 1
- 0
app/services/unfollow_service.rb 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

Loading…
Cancel
Save