diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-03-02 21:47:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-02 21:47:03 +0100 |
commit | 3637a0101e1f5095397f190e88f281d603797c32 (patch) | |
tree | 290569d5d454dc1a1478c35b7a4d6755ccfcad2c /app/controllers/api | |
parent | d9e30efa5ecc87bc9be7b2e28baaf34bd01032f5 (diff) | |
parent | c69d94ef7e13360e502635fc8bb1bbf8e13dfd74 (diff) |
Merge pull request #1710 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/api')
-rw-r--r-- | app/controllers/api/v1/reports_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/api/v1/statuses_controller.rb | 5 |
2 files changed, 4 insertions, 13 deletions
diff --git a/app/controllers/api/v1/reports_controller.rb b/app/controllers/api/v1/reports_controller.rb index 052d70cc8..8ff6c8fe5 100644 --- a/app/controllers/api/v1/reports_controller.rb +++ b/app/controllers/api/v1/reports_controller.rb @@ -10,9 +10,7 @@ class Api::V1::ReportsController < Api::BaseController @report = ReportService.new.call( current_account, reported_account, - status_ids: reported_status_ids, - comment: report_params[:comment], - forward: report_params[:forward] + report_params ) render json: @report, serializer: REST::ReportSerializer @@ -20,14 +18,6 @@ class Api::V1::ReportsController < Api::BaseController private - def reported_status_ids - reported_account.statuses.with_discarded.find(status_ids).pluck(:id) - end - - def status_ids - Array(report_params[:status_ids]) - end - def reported_account Account.find(report_params[:account_id]) end diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index eaac8e563..ddd7c33ae 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -94,8 +94,9 @@ class Api::V1::StatusesController < Api::BaseController end def set_thread - @thread = status_params[:in_reply_to_id].blank? ? nil : Status.find(status_params[:in_reply_to_id]) - rescue ActiveRecord::RecordNotFound + @thread = Status.find(status_params[:in_reply_to_id]) if status_params[:in_reply_to_id].present? + authorize(@thread, :show?) if @thread.present? + rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError render json: { error: I18n.t('statuses.errors.in_reply_not_found') }, status: 404 end |