about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb21
1 files changed, 7 insertions, 14 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 2462d6b7d..b1965f176 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -60,22 +60,15 @@ class Status < ActiveRecord::Base
   end
 
   def mentions
-    m = []
-
-    m << thread.account if reply?
-    m << reblog.account if reblog?
-
-    unless reblog?
-      self.text.scan(Account::MENTION_RE).each do |match|
-        uri = match.first
-        username, domain = uri.split('@')
-        account = Account.find_by(username: username, domain: domain)
-
-        m << account unless account.nil?
-      end
+    if @mentions.nil?
+      @mentions = []
+      @mentions << thread.account if reply?
+      @mentions << reblog.account if reblog?
+      self.mentioned_accounts.each { |mention| @mentions << mention.account } unless reblog?
+      @mentions = @mentions.uniq
     end
 
-    m.uniq
+    @mentions
   end
 
   def ancestors