allow sharekeys to be used with the api status controller

master
multiple creatures 2020-01-12 23:44:35 -06:00
parent 6d6f6b3385
commit 651c569c3f
1 changed files with 7 additions and 1 deletions

View File

@ -79,7 +79,13 @@ class Api::V1::StatusesController < Api::BaseController
def set_status
@status = Status.find(params[:id])
authorize @status, :show?
@sharekey = params[:key]
if @status.sharekey.present? && @sharekey == @status.sharekey.key
skip_authorization
else
authorize @status, :show?
end
rescue Mastodon::NotPermittedError
raise ActiveRecord::RecordNotFound
end