A lot of fixes from a live test
This commit is contained in:
parent
f1654da7ad
commit
47d50b0e39
17 changed files with 59 additions and 27 deletions
|
@ -9,7 +9,7 @@ class FollowService < BaseService
|
|||
|
||||
follow = source_account.follow!(target_account)
|
||||
send_interaction_service.(follow.stream_entry, target_account)
|
||||
source_account.ping!(atom_user_stream_url(id: source_account.id), HUB_URL)
|
||||
source_account.ping!(atom_user_stream_url(id: source_account.id), [HUB_URL])
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -7,7 +7,7 @@ class PostStatusService < BaseService
|
|||
def call(account, text, in_reply_to = nil)
|
||||
status = account.statuses.create!(text: text, thread: in_reply_to)
|
||||
process_mentions_service.(status)
|
||||
account.ping!(atom_user_stream_url(id: account.id), HUB_URL)
|
||||
account.ping!(atom_user_stream_url(id: account.id), [HUB_URL])
|
||||
status
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class ProcessFeedService < BaseService
|
|||
end
|
||||
|
||||
xml.xpath('//xmlns:entry').each do |entry|
|
||||
next unless [:note, :comment, :activity].includes? object_type(entry)
|
||||
next unless [:note, :comment, :activity].include? object_type(entry)
|
||||
|
||||
status = Status.find_by(uri: activity_id(entry))
|
||||
|
||||
|
@ -88,7 +88,7 @@ class ProcessFeedService < BaseService
|
|||
end
|
||||
|
||||
def thread_id(xml)
|
||||
xml.at_xpath('./thr:in-reply-to-id').attribute('ref').value
|
||||
xml.at_xpath('./thr:in-reply-to').attribute('ref').value
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
|
|
@ -43,7 +43,7 @@ class ProcessInteractionService < BaseService
|
|||
end
|
||||
|
||||
def mentions_account?(xml, account)
|
||||
xml.xpath('/xmlns:entry/xmlns:link[@rel="mentioned"]').each { |mention_link| return true if mention_link.attribute('ref') == profile_url(name: account.username) }
|
||||
xml.xpath('/xmlns:entry/xmlns:link[@rel="mentioned"]').each { |mention_link| return true if mention_link.attribute('href').value == profile_url(account) }
|
||||
false
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class ReblogService < BaseService
|
|||
# @return [Status]
|
||||
def call(account, reblogged_status)
|
||||
reblog = account.statuses.create!(reblog: reblogged_status, text: '')
|
||||
account.ping!(atom_user_stream_url(id: account.id), HUB_URL)
|
||||
account.ping!(atom_user_stream_url(id: account.id), [HUB_URL])
|
||||
return reblog if reblogged_status.local?
|
||||
send_interaction_service.(reblog.stream_entry, reblogged_status.account)
|
||||
reblog
|
||||
|
|
|
@ -5,7 +5,7 @@ class SendInteractionService < BaseService
|
|||
# @param [StreamEntry] stream_entry
|
||||
# @param [Account] target_account
|
||||
def call(stream_entry, target_account)
|
||||
envelope = salmon.pack(entry_xml(stream_entry), target_account.keypair)
|
||||
envelope = salmon.pack(entry_xml(stream_entry), stream_entry.account.keypair)
|
||||
salmon.post(target_account.salmon_url, envelope)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue