mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 17:24:51 +08:00
Merge pull request #8044 from aignatov-bio/ai-sci-11284-fix-archived-items
Fix permission for archived rows and download link [SCI-11284][SCI-11285]
This commit is contained in:
commit
8e91284e29
3 changed files with 7 additions and 2 deletions
|
@ -40,7 +40,7 @@
|
|||
<div class="basis-1/4 flex justify-end">
|
||||
<a class="btn btn-icon p-0 px-2 hover:bg-sn-light-grey"
|
||||
v-if="enabled || index === 0"
|
||||
:href="fileVersion.attributes.url"
|
||||
:href="fileVersion.attributes.download_url"
|
||||
target="_blank"
|
||||
data-render-tooltip="true"
|
||||
:title="i18n.t('assets.file_versions_modal.download')"
|
||||
|
|
|
@ -27,6 +27,7 @@ Canaid::Permissions.register_for(Asset) do
|
|||
if object.repository_column.repository.is_a?(RepositorySnapshot)
|
||||
false
|
||||
else
|
||||
object.repository_row.active? &&
|
||||
can_manage_repository_assets?(user, object.repository_column.repository)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module ActiveStorage
|
|||
class BlobSerializer < ActiveModel::Serializer
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
attributes :filename, :extension, :basename, :url, :created_at, :byte_size, :version, :restored_from_version, :created_by
|
||||
attributes :filename, :extension, :basename, :url, :created_at, :byte_size, :version, :restored_from_version, :created_by, :download_url
|
||||
|
||||
def basename
|
||||
object.filename.base
|
||||
|
@ -14,6 +14,10 @@ module ActiveStorage
|
|||
object.filename.extension_without_delimiter
|
||||
end
|
||||
|
||||
def download_url
|
||||
rails_blob_url(object, disposition: 'attachment')
|
||||
end
|
||||
|
||||
def version
|
||||
object.metadata['version'] || 1
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue