about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-02-24 18:25:04 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-02-24 18:25:04 +0100
commit79609d62705fa7060c1d1ab78234b4aabdbd7e0f (patch)
tree12cef6a016a9052fdfb0d39ac10df8eab55d46a3 /app/models/status.rb
parent8da8387afee66e17b3ec864ba84a7a065187818b (diff)
Add service for posting statuses (normal and replies), mention regex to
fetch webfinger information of mentioned accounts
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index be616dce6..80719140e 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -51,6 +51,17 @@ class Status < ActiveRecord::Base
     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 = uri.split('@').first
+        domain   = uri.split('@').size == 2 ? uri.split('@').last : nil
+        account  = Account.find_by(username: username, domain: domain)
+
+        m << account unless account.nil?
+      end
+    end
+
     m
   end