diff options
author | David Yip <yipdw@member.fsf.org> | 2017-10-25 16:01:20 -0500 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2017-10-25 16:01:20 -0500 |
commit | 42f2045c217df4b482e6ce70615a1d3252e0e972 (patch) | |
tree | 19e002405d30a50aca740a979efeb6b3a9d1e186 /app/models | |
parent | 5f0268ab842990740d79d44e77159bb52f1a08ce (diff) | |
parent | a76b02422847c5d5996c03284f3dd5e662bbfb9d (diff) |
Merge remote-tracking branch 'STJrInuyasha/feature/direct-timeline' into gs-direct-timeline
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index 30d53f298..d78a921b5 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 |