include media_entry_id in media_preview endpoint
test plan: * previews for media files in new files should work closes #CNVS-18761 Change-Id: I5499f64d7a0f2a6a9efb66a7caae20df40ae2678 Reviewed-on: https://gerrit.instructure.com/49222 Reviewed-by: Clay Diffrient <cdiffrient@instructure.com> Tested-by: Jenkins QA-Review: Clare Strong <clare@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
a093502e4a
commit
d9dec69f83
|
@ -5,4 +5,4 @@ require [
|
|||
|
||||
$preview = $("#media_preview")
|
||||
data = $preview.data()
|
||||
$preview.mediaComment('show_inline', 'maybe', data.type, data.download_url)
|
||||
$preview.mediaComment('show_inline', data.media_entry_id || 'maybe', data.type, data.download_url)
|
||||
|
|
|
@ -552,6 +552,8 @@ class FilesController < ApplicationController
|
|||
}
|
||||
}
|
||||
|
||||
json[:attachment][:media_entry_id] = attachment.media_entry_id if attachment.media_entry_id
|
||||
|
||||
if (params[:verifier] && params[:verifier] == attachment.uuid) ||
|
||||
attachment.grants_right?(@current_user, session, :download)
|
||||
# Right now we assume if they ask for json data on the attachment
|
||||
|
|
|
@ -44,6 +44,7 @@ module AttachmentHelper
|
|||
def media_preview_attributes(attachment, attrs={})
|
||||
attrs[:type] = attachment.content_type.match(/video/) ? 'video' : 'audio'
|
||||
attrs[:download_url] = context_url(attachment.context, :context_file_download_url, attachment.id)
|
||||
attrs[:media_entry_id] = attachment.media_entry_id if attachment.media_entry_id
|
||||
attrs.inject("") { |s,(attr,val)| s << "data-#{attr}=#{val} " }
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue