diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-07-17 23:10:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-17 23:10:31 +0200 |
commit | ab1488a6ad93f572e1d184cb9653f76fd408474f (patch) | |
tree | f1dd126f4745eb99243f390169fb957a72f5acc6 /app/controllers/api/v1/admin/trends/statuses_controller.rb | |
parent | 325ebb76b19bd20e1b76d8bc26c11cab02f6571c (diff) | |
parent | 6c0d73a675d62f676b005c06593fd69e9a7bc0e5 (diff) |
Merge pull request #1804 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/api/v1/admin/trends/statuses_controller.rb')
-rw-r--r-- | app/controllers/api/v1/admin/trends/statuses_controller.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/app/controllers/api/v1/admin/trends/statuses_controller.rb b/app/controllers/api/v1/admin/trends/statuses_controller.rb index cb145f165..c39f77363 100644 --- a/app/controllers/api/v1/admin/trends/statuses_controller.rb +++ b/app/controllers/api/v1/admin/trends/statuses_controller.rb @@ -1,17 +1,19 @@ # frozen_string_literal: true -class Api::V1::Admin::Trends::StatusesController < Api::BaseController +class Api::V1::Admin::Trends::StatusesController < Api::V1::Trends::StatusesController before_action -> { authorize_if_got_token! :'admin:read' } - before_action :require_staff! - before_action :set_statuses - - def index - render json: @statuses, each_serializer: REST::StatusSerializer - end private - def set_statuses - @statuses = cache_collection(Trends.statuses.query.limit(limit_param(DEFAULT_STATUSES_LIMIT)), Status) + def enabled? + super || current_user&.can?(:manage_taxonomies) + end + + def statuses_from_trends + if current_user&.can?(:manage_taxonomies) + Trends.statuses.query + else + super + end end end |