mirror of
https://github.com/nextcloud/server.git
synced 2026-05-26 19:32:28 -04:00
Merge pull request #59865 from nextcloud/backport/59850/stable33
[stable33] fix(files): do not show convert-file action in view-only shares
This commit is contained in:
commit
b25e7b8d70
3 changed files with 10 additions and 5 deletions
|
|
@ -7,9 +7,10 @@ import type { IFileAction } from '@nextcloud/files'
|
|||
|
||||
import AutoRenewSvg from '@mdi/svg/svg/autorenew.svg?raw'
|
||||
import { getCapabilities } from '@nextcloud/capabilities'
|
||||
import { registerFileAction } from '@nextcloud/files'
|
||||
import { Permission, registerFileAction } from '@nextcloud/files'
|
||||
import { t } from '@nextcloud/l10n'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import { isPublicShare } from '@nextcloud/sharing/public'
|
||||
import { convertFile, convertFiles } from './convertUtils.ts'
|
||||
|
||||
type ConversionsProvider = {
|
||||
|
|
@ -30,7 +31,11 @@ export function registerConvertActions() {
|
|||
id: `convert-${from}-${to}`,
|
||||
displayName: () => t('files', 'Save as {displayName}', { displayName }),
|
||||
iconSvgInline: () => generateIconSvg(to),
|
||||
enabled: ({ nodes }) => {
|
||||
enabled: ({ nodes, folder }) => {
|
||||
if (isPublicShare() && !(folder.permissions & Permission.CREATE)) {
|
||||
// cannot create the converted file in a public share if we don't have create permissions
|
||||
return false
|
||||
}
|
||||
// Check that all nodes have the same mime type
|
||||
return nodes.every((node) => from === node.mime)
|
||||
},
|
||||
|
|
|
|||
4
dist/files-init.js
vendored
4
dist/files-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-init.js.map
vendored
2
dist/files-init.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue