diff options
Diffstat (limited to 'app/services/process_mentions_service.rb')
-rw-r--r-- | app/services/process_mentions_service.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index 93866666a..e1fc2f038 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -4,15 +4,17 @@ class ProcessMentionsService < BaseService # remote users # @param [Status] status def call(status) + return unless status.local? + status.text.scan(Account::MENTION_RE).each do |match| - username, domain = match.first.split('@') - local_account = Account.find_by(username: username, domain: domain) + username, domain = match.first.split('@') + mentioned_account = Account.find_by(username: username, domain: domain) - if local_account.nil? - local_account = follow_remote_account_service.("acct:#{match.first}") + if mentioned_account.nil? + mentioned_account = follow_remote_account_service.("acct:#{match.first}") end - local_account.mentions.first_or_create(status: status) + mentioned_account.mentions.first_or_create(status: status) end status.mentions.each do |mentioned_account| |