about summary refs log tree commit diff
path: root/app/controllers/api/v1/trends/links_controller.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-02-26 09:29:23 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-02-26 09:29:23 +0100
commitbe493b6c0d60778257cbd6247f9287f939fc7e4e (patch)
tree07c127fc0e059ccd185c40a3c4497706f3bcacc7 /app/controllers/api/v1/trends/links_controller.rb
parente48eaf64cc7cb0cfab388331c4823ee5fb580d59 (diff)
parenta5c24d5c4d75f3f3144f69c8f60f542707a82584 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/models/account.rb`:
  Not a real conflict, just upstream getting rid of unused constants too close
  to glitch-soc-specific contents.
  Removed unused constants like upstream did.
- `app/models/trends.rb`:
  Conflict because glitch-soc disabled email notifications for trending links.
  Upstream has refactored this quite a bit and added trending posts.
  Took upstream code, but disabling the extra trending stuff will come in
  another commit.
- `app/views/admin/trends/links/index.html.haml`:
  Conflict due to glitch-soc's theming system.
  Ported upstream changes accordingly.
Diffstat (limited to 'app/controllers/api/v1/trends/links_controller.rb')
-rw-r--r--app/controllers/api/v1/trends/links_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/api/v1/trends/links_controller.rb b/app/controllers/api/v1/trends/links_controller.rb
index 1c3ab1e1c..ad20e7f8b 100644
--- a/app/controllers/api/v1/trends/links_controller.rb
+++ b/app/controllers/api/v1/trends/links_controller.rb
@@ -12,10 +12,14 @@ class Api::V1::Trends::LinksController < Api::BaseController
   def set_links
     @links = begin
       if Setting.trends
-        Trends.links.get(true, limit_param(10))
+        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