suggestions_controller.rb 626 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_recently_used_tags, only: :index
  6. def index
  7. render json: @recently_used_tags, each_serializer: REST::TagSerializer, relationships: TagRelationshipsPresenter.new(@recently_used_tags, current_user&.account_id)
  8. end
  9. private
  10. def set_recently_used_tags
  11. @recently_used_tags = Tag.recently_used(current_account).where.not(id: current_account.featured_tags).limit(10)
  12. end
  13. end