mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-15 15:44:56 +01:00
27965ce5ed
* Add trending statuses * Fix dangling items with stale scores in localized sets * Various fixes and improvements - Change approve_all/reject_all to approve_accounts/reject_accounts - Change Trends::Query methods to not mutate the original query - Change Trends::Query#skip to offset - Change follow recommendations to be refreshed in a transaction * Add tests for trending statuses filtering behaviour * Fix not applying filtering scope in controller
26 lines
467 B
Ruby
26 lines
467 B
Ruby
# 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
|
|
links_from_trends
|
|
else
|
|
[]
|
|
end
|
|
end
|
|
end
|
|
|
|
def links_from_trends
|
|
Trends.links.query.allowed.in_locale(content_locale).limit(limit_param(10))
|
|
end
|
|
end
|