From f783ec279d03b7b56c96af5e18e0dd8c7a0710a1 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Thu, 15 Aug 2019 17:05:59 -0500 Subject: [PATCH] allow out-of-body mentions --- app/services/process_mentions_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index 738bfa2d6..c38c89937 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -8,7 +8,7 @@ class ProcessMentionsService < BaseService return unless status.local? && !status.draft? @status = status - mentions = [] + mentions = Mention.where(status: status).to_a status.text = status.text.gsub(Account::MENTION_RE) do |match| username, domain = Regexp.last_match(1).split('@') @@ -32,7 +32,7 @@ class ProcessMentionsService < BaseService status.save! return if skip_notify - mentions.each { |mention| create_notification(mention) } + mentions.uniq.each { |mention| create_notification(mention) } end private