Skip to content

Commit

Permalink
Resolve remote accounts when mentioned even if they are already known
Browse files Browse the repository at this point in the history
This commit reduces the risk of not having up-to-date public key or protocol
information for a remote account, which is required to deliver toots
(especially direct messages).
  • Loading branch information
ClearlyClaire committed Oct 27, 2017
1 parent 3e9236b commit 3e2389e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions app/services/process_mentions_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ def call(status)
return unless status.local?

status.text.scan(Account::MENTION_RE).each do |match|
username, domain = match.first.split('@')
mentioned_account = Account.find_remote(username, domain)

if mentioned_account.nil? && !domain.nil?
begin
mentioned_account = resolve_remote_account_service.call(match.first.to_s)
rescue Goldfinger::Error, HTTP::Error
mentioned_account = nil
end
begin
mentioned_account = resolve_remote_account_service.call(match.first.to_s)
rescue Goldfinger::Error, HTTP::Error
mentioned_account = nil
end

next if mentioned_account.nil?
Expand Down

0 comments on commit 3e2389e

Please sign in to comment.