2019-09-09 17:50:33 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Api::V1::FeaturedTags::SuggestionsController < Api::BaseController
|
|
|
|
before_action -> { doorkeeper_authorize! :read, :'read:accounts' }, only: :index
|
|
|
|
before_action :require_user!
|
2020-09-08 00:47:41 +09:00
|
|
|
before_action :set_recently_used_tags, only: :index
|
2019-09-09 17:50:33 +09:00
|
|
|
|
|
|
|
def index
|
2020-09-08 00:47:41 +09:00
|
|
|
render json: @recently_used_tags, each_serializer: REST::TagSerializer
|
2019-09-09 17:50:33 +09:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-09-08 00:47:41 +09:00
|
|
|
def set_recently_used_tags
|
|
|
|
@recently_used_tags = Tag.recently_used(current_account).where.not(id: current_account.featured_tags).limit(10)
|
2019-09-09 17:50:33 +09:00
|
|
|
end
|
|
|
|
end
|