mirror of https://github.com/tootsuite/mastodon
Add `FeaturedTag.by_status_count` ordering scope
parent
295ad6f19a
commit
46e623506d
|
@ -29,6 +29,6 @@ class Api::V1::FeaturedTagsController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_featured_tags
|
def set_featured_tags
|
||||||
@featured_tags = current_account.featured_tags.order(statuses_count: :desc)
|
@featured_tags = current_account.featured_tags.by_status_count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Settings::FeaturedTagsController < Settings::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_featured_tags
|
def set_featured_tags
|
||||||
@featured_tags = current_account.featured_tags.order(statuses_count: :desc).reject(&:new_record?)
|
@featured_tags = current_account.featured_tags.by_status_count.reject(&:new_record?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_recently_used_tags
|
def set_recently_used_tags
|
||||||
|
|
|
@ -29,6 +29,7 @@ class FeaturedTag < ApplicationRecord
|
||||||
before_create :reset_data
|
before_create :reset_data
|
||||||
|
|
||||||
scope :by_name, ->(name) { joins(:tag).where(tag: { name: HashtagNormalizer.new.normalize(name) }) }
|
scope :by_name, ->(name) { joins(:tag).where(tag: { name: HashtagNormalizer.new.normalize(name) }) }
|
||||||
|
scope :by_status_count, -> { order(statuses_count: :desc) }
|
||||||
|
|
||||||
LIMIT = 10
|
LIMIT = 10
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue