about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-06-22 02:38:50 +0200
committerGitHub <noreply@github.com>2017-06-22 02:38:50 +0200
commit0190aac240fd804180a56b5fe174526a9e4c3f6d (patch)
tree82780606af6668bea6b72ee0672af358b8266588 /app
parentcc382c5006ed5c4c18c3547150b214807b217c7b (diff)
Fix regression from #3842 (#3892)
* Fix regression from #3842

Simplify the query by omitting all direct statuses. Private statuses
are allowed because they are from accounts we are following (so
by definition)

Resolves #3887 (alternative)

* Adjust test
Diffstat (limited to 'app')
-rw-r--r--app/models/status.rb10
1 files changed, 1 insertions, 9 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 544d2e005..791d96df1 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -131,15 +131,7 @@ class Status < ApplicationRecord
     end
 
     def as_home_timeline(account)
-      # 'references' is a workaround for the following issue:
-      # Inconsistent results with #or in ActiveRecord::Relation with respect to documentation Issue #24055 rails/rails
-      # https://github.com/rails/rails/issues/24055
-      references(:mentions)
-        .where.not(visibility: :direct)
-        .or(where(mentions: { account: account }))
-        .where(follows: { account_id: account })
-        .or(references(:mentions, :follows).where(account: account))
-        .left_outer_joins(account: :followers).left_outer_joins(:mentions).group(:id)
+      where(account: [account] + account.following).where(visibility: [:public, :unlisted, :private])
     end
 
     def as_public_timeline(account = nil, local_only = false)