|
|
@@ -47,7 +47,7 @@ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<template #actions> |
|
|
|
<NcActionButton v-if="enableLabeling" |
|
|
|
<NcActionButton v-if="enableLabeling && hasUpdatePermissions" |
|
|
|
:close-after-click="true" |
|
|
|
@click="openVersionLabelModal"> |
|
|
|
<template #icon> |
|
|
@@ -63,7 +63,7 @@ |
|
|
|
</template> |
|
|
|
{{ t('files_versions', 'Compare to current version') }} |
|
|
|
</NcActionButton> |
|
|
|
<NcActionButton v-if="!isCurrent" |
|
|
|
<NcActionButton v-if="!isCurrent && hasUpdatePermissions" |
|
|
|
:close-after-click="true" |
|
|
|
@click="restoreVersion"> |
|
|
|
<template #icon> |
|
|
@@ -71,7 +71,8 @@ |
|
|
|
</template> |
|
|
|
{{ t('files_versions', 'Restore version') }} |
|
|
|
</NcActionButton> |
|
|
|
<NcActionLink :href="downloadURL" |
|
|
|
<NcActionLink v-if="isDownloadable" |
|
|
|
:href="downloadURL" |
|
|
|
:close-after-click="true" |
|
|
|
:download="downloadURL"> |
|
|
|
<template #icon> |
|
|
@@ -79,7 +80,7 @@ |
|
|
|
</template> |
|
|
|
{{ t('files_versions', 'Download version') }} |
|
|
|
</NcActionLink> |
|
|
|
<NcActionButton v-if="!isCurrent && enableDeletion" |
|
|
|
<NcActionButton v-if="!isCurrent && enableDeletion && hasDeletePermissions" |
|
|
|
:close-after-click="true" |
|
|
|
@click="deleteVersion"> |
|
|
|
<template #icon> |
|
|
@@ -136,6 +137,9 @@ import { translate } from '@nextcloud/l10n' |
|
|
|
import { joinPaths } from '@nextcloud/paths' |
|
|
|
import { getRootUrl } from '@nextcloud/router' |
|
|
|
import { loadState } from '@nextcloud/initial-state' |
|
|
|
import { Permission } from '@nextcloud/files' |
|
|
|
|
|
|
|
import { hasPermissions } from '../../../files_sharing/src/lib/SharePermissionsToolBox.js' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'Version', |
|
|
@@ -260,6 +264,33 @@ export default { |
|
|
|
enableDeletion() { |
|
|
|
return this.capabilities.files.version_deletion === true |
|
|
|
}, |
|
|
|
|
|
|
|
/** @return {boolean} */ |
|
|
|
hasDeletePermissions() { |
|
|
|
return hasPermissions(this.fileInfo.permissions, Permission.DELETE) |
|
|
|
}, |
|
|
|
|
|
|
|
/** @return {boolean} */ |
|
|
|
hasUpdatePermissions() { |
|
|
|
return hasPermissions(this.fileInfo.permissions, Permission.UPDATE) |
|
|
|
}, |
|
|
|
|
|
|
|
/** @return {boolean} */ |
|
|
|
isDownloadable() { |
|
|
|
if ((this.fileInfo.permissions & Permission.READ) === 0) { |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
// If the mount type is a share, ensure it got download permissions. |
|
|
|
if (this.fileInfo.mountType === 'shared') { |
|
|
|
const downloadAttribute = this.fileInfo.shareAttributes.find((attribute) => attribute.scope === 'permissions' && attribute.key === 'download') |
|
|
|
if (downloadAttribute !== undefined && downloadAttribute.enabled === false) { |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return true |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
openVersionLabelModal() { |