diff options
author | ThibG <thib@sitedethib.com> | 2018-12-18 19:37:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 19:37:07 +0100 |
commit | 74ee5bdf37799fba5990a6b492e3d52c32efe8d7 (patch) | |
tree | afdeb6b23ff4d7bd5e53c4e13cb2c3dfafb4b986 /app/models/account.rb | |
parent | 36d27e289177fdec5332539c94b8192022a412f2 (diff) | |
parent | 0ef2c1415a13d305d4c73c71f27a1366eee702a0 (diff) |
Merge pull request #862 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 71264bc9f..60ad0788e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -95,10 +95,10 @@ class Account < ApplicationRecord scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) } scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) } scope :searchable, -> { where(suspended: false).where(moved_to_account_id: nil) } - scope :discoverable, -> { where(silenced: false).where(discoverable: true).joins(:account_stat).where(AccountStat.arel_table[:followers_count].gteq(MIN_FOLLOWERS_DISCOVERY)) } + scope :discoverable, -> { searchable.where(silenced: false).where(discoverable: true).joins(:account_stat).where(AccountStat.arel_table[:followers_count].gteq(MIN_FOLLOWERS_DISCOVERY)).by_recent_status } scope :tagged_with, ->(tag) { joins(:accounts_tags).where(accounts_tags: { tag_id: tag }) } - scope :popular, -> { order('account_stats.followers_count desc') } scope :by_recent_status, -> { order(Arel.sql('(case when account_stats.last_status_at is null then 1 else 0 end) asc, account_stats.last_status_at desc')) } + scope :popular, -> { order('account_stats.followers_count desc') } delegate :email, :unconfirmed_email, |