about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorSurinna Curtis <ekiru.0@gmail.com>2017-11-16 01:21:16 -0600
committerSurinna Curtis <ekiru.0@gmail.com>2017-11-16 01:21:16 -0600
commit35fbdc36f92b610e8a73e2acb220e87cf5fc83b0 (patch)
treefcd9bdb5ba49ab7a6a79590c74db858ae77b4239 /app/models/status.rb
parent30237259367a0ef2b20908518b86bbeb358999b5 (diff)
parent88627fd7aa2493a6890d60a5965459e4c7fe6fe9 (diff)
Merge tootsuite/master at 30237259367a0ef2b20908518b86bbeb358999b5
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index b4f314311..1dda6594e 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -154,6 +154,14 @@ class Status < ApplicationRecord
       where(account: [account] + account.following).where(visibility: [:public, :unlisted, :private])
     end
 
+    def as_direct_timeline(account)
+      query = joins("LEFT OUTER JOIN mentions ON statuses.id = mentions.status_id AND mentions.account_id = #{account.id}")
+              .where("mentions.account_id = #{account.id} OR statuses.account_id = #{account.id}")
+              .where(visibility: [:direct])
+
+      apply_timeline_filters(query, account, false)
+    end
+
     def as_public_timeline(account = nil, local_only = false)
       query = timeline_scope(local_only).without_replies
 
@@ -261,6 +269,11 @@ class Status < ApplicationRecord
     end
   end
 
+  def local_only?
+    # match both with and without U+FE0F (the emoji variation selector)
+    /👁\ufe0f?\z/.match?(content)
+  end
+
   private
 
   def store_uri