diff options
author | ThibG <thib@sitedethib.com> | 2020-09-08 17:20:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-08 17:20:00 +0200 |
commit | 6e83020950ab81c6be6b3bfec92643f1b0d23ce6 (patch) | |
tree | ccd775be4b73170fcbf45407b84ad35fc37fb853 /app/models/tag.rb | |
parent | 437d71bddf967573df3912ee5976f7c5a5a7b4c7 (diff) | |
parent | 9748f074a385fce5ad6913b1a22fb7ea9e7566db (diff) |
Merge pull request #1419 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/tag.rb')
-rw-r--r-- | app/models/tag.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/tag.rb b/app/models/tag.rb index bce76fc16..df2f86d95 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -39,7 +39,7 @@ class Tag < ApplicationRecord scope :listable, -> { where(listable: [true, nil]) } scope :trendable, -> { Setting.trendable_by_default ? where(trendable: [true, nil]) : where(trendable: true) } scope :discoverable, -> { listable.joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).order(Arel.sql('account_tag_stats.accounts_count desc')) } - scope :most_used, ->(account) { joins(:statuses).where(statuses: { account: account }).group(:id).order(Arel.sql('count(*) desc')) } + scope :recently_used, ->(account) { joins(:statuses).where(statuses: { id: account.statuses.select(:id).limit(1000) }).group(:id).order(Arel.sql('count(*) desc')) } scope :matches_name, ->(value) { where(arel_table[:name].matches("#{value}%")) } delegate :accounts_count, |