suggestions_controller.rb 513 B

1234567891011121314151617
  1. # frozen_string_literal: true
  2. class Api::V1::FeaturedTags::SuggestionsController < Api::BaseController
  3. before_action -> { doorkeeper_authorize! :read, :'read:accounts' }, only: :index
  4. before_action :require_user!
  5. before_action :set_most_used_tags, only: :index
  6. def index
  7. render json: @most_used_tags, each_serializer: REST::TagSerializer
  8. end
  9. private
  10. def set_most_used_tags
  11. @most_used_tags = Tag.most_used(current_account).where.not(id: current_account.featured_tags).limit(10)
  12. end
  13. end