]>
cat aescling's git repositories - mastodon.git/blob - app/controllers/media_controller.rb
1 # frozen_string_literal: true
3 class MediaController
< ApplicationController
6 before_action
:set_media_attachment
7 before_action
:verify_permitted_status!
10 redirect_to
@media_attachment.file
.url(:original)
14 @body_classes = 'player'
15 raise ActiveRecord
::RecordNotFound unless @media_attachment.video
? || @media_attachment.gifv
?
20 def set_media_attachment
21 @media_attachment = MediaAttachment
.attached
.find_by!
(shortcode
: params
[:id] || params
[:medium_id])
24 def verify_permitted_status!
25 authorize
@media_attachment.status
, :show?
26 rescue Mastodon
::NotPermittedError
27 # Reraise in order to get a 404 instead of a 403 error code
28 raise ActiveRecord
::RecordNotFound
This page took 0.069647 seconds and 4 git commands to generate.