mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 01:35:34 +08:00
Fix wopi file creation [SCI-7014] (#4276)
This commit is contained in:
parent
b9d953b3a4
commit
e4c5c66d35
2 changed files with 4 additions and 4 deletions
|
@ -202,10 +202,9 @@ class AssetsController < ApplicationController
|
|||
|
||||
# Prepare file preview in advance
|
||||
asset.medium_preview.processed && asset.large_preview.processed
|
||||
|
||||
# Return edit url and asset info
|
||||
render json: {
|
||||
attributes: AssetSerializer.new(asset, user: current_user).as_json,
|
||||
attributes: AssetSerializer.new(asset, scope: { user: current_user }).as_json,
|
||||
success: true,
|
||||
edit_url: edit_url
|
||||
}, status: :ok
|
||||
|
|
|
@ -93,6 +93,7 @@ class AssetSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def urls
|
||||
@user = scope[:user] || @instance_options[:user]
|
||||
urls = {
|
||||
preview: asset_file_preview_path(object),
|
||||
download: rails_blob_path(object.file, disposition: 'attachment'),
|
||||
|
@ -101,7 +102,7 @@ class AssetSerializer < ActiveModel::Serializer
|
|||
marvin_js: marvin_js_asset_path(object),
|
||||
marvin_js_icon: image_path('icon_small/marvinjs.svg')
|
||||
}
|
||||
if can_manage_asset?(object)
|
||||
if can_manage_asset?(@user, object)
|
||||
urls.merge!(
|
||||
toggle_view_mode: toggle_view_mode_path(object),
|
||||
edit_asset: edit_asset_path(object),
|
||||
|
@ -110,7 +111,7 @@ class AssetSerializer < ActiveModel::Serializer
|
|||
delete: asset_destroy_path(object)
|
||||
)
|
||||
end
|
||||
if wopi && can_manage_asset?(object)
|
||||
if wopi && can_manage_asset?(@user, object)
|
||||
urls[:wopi_action] = object.get_action_url(@instance_options[:user], 'embedview')
|
||||
end
|
||||
urls[:blob] = rails_blob_path(object.file, disposition: 'attachment') if object.file.attached?
|
||||
|
|
Loading…
Reference in a new issue