about summary refs log tree commit diff
path: root/app/controllers/api/v1/trends/links_controller.rb
blob: 1c3ab1e1c2e777b10aef6ea1714220457dbb6279 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class Api::V1::Trends::LinksController < Api::BaseController
  before_action :set_links

  def index
    render json: @links, each_serializer: REST::Trends::LinkSerializer
  end

  private

  def set_links
    @links = begin
      if Setting.trends
        Trends.links.get(true, limit_param(10))
      else
        []
      end
    end
  end
end