mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
Merge pull request #45344 from nextcloud/fix/stable27-download-action
[stable27] fix: Keep download action for files and hide only for relevant files
This commit is contained in:
commit
b127e020ec
8 changed files with 28 additions and 20 deletions
|
|
@ -653,6 +653,13 @@
|
|||
context.fileList.showFileBusyState(filename, true);
|
||||
OCA.Files.Files.handleDownload(url, disableLoadingState);
|
||||
}
|
||||
},
|
||||
shouldRender: function(context) {
|
||||
var fileData = context.fileInfoModel
|
||||
if (_.isFunction(fileData.canDownload) && !fileData.canDownload()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -707,6 +714,13 @@
|
|||
}
|
||||
context.fileList.dirInfo.dirLastCopiedTo = targetPath;
|
||||
}, false, "httpd/unix-directory", true, actions, dialogDir);
|
||||
},
|
||||
shouldRender: function(context) {
|
||||
var fileData = context.fileInfoModel
|
||||
if (_.isFunction(fileData.canDownload) && !fileData.canDownload()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -82,6 +82,12 @@
|
|||
var defaultAction = fileActions.getCurrentDefaultFileAction();
|
||||
|
||||
var items = _.filter(actions, function(actionSpec) {
|
||||
if (actionSpec.shouldRender) {
|
||||
if (!actionSpec.shouldRender(self._context)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !defaultAction || actionSpec.name !== defaultAction.name;
|
||||
});
|
||||
items = _.map(items, function(item) {
|
||||
|
|
|
|||
|
|
@ -390,7 +390,8 @@
|
|||
icon: OC.MimeType.getIconUrl(share.mimetype),
|
||||
mimetype: share.mimetype,
|
||||
hasPreview: share.has_preview,
|
||||
tags: share.tags || []
|
||||
tags: share.tags || [],
|
||||
shareAttributes: JSON.parse(share.attributes),
|
||||
}
|
||||
if (share.item_type === 'folder') {
|
||||
file.type = 'dir'
|
||||
|
|
|
|||
|
|
@ -86,19 +86,6 @@ import { getCapabilities } from '@nextcloud/capabilities'
|
|||
var tr = oldCreateRow.apply(this, arguments)
|
||||
var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData)
|
||||
|
||||
if (fileData.permissions === 0) {
|
||||
// no permission, disabling sidebar
|
||||
delete fileActions.actions.all.Comment
|
||||
delete fileActions.actions.all.Details
|
||||
delete fileActions.actions.all.Goto
|
||||
}
|
||||
if (_.isFunction(fileData.canDownload) && !fileData.canDownload()) {
|
||||
delete fileActions.actions.all.Download
|
||||
if ((fileData.permissions & OC.PERMISSION_UPDATE) === 0) {
|
||||
// neither move nor copy is allowed, remove the action completely
|
||||
delete fileActions.actions.all.MoveCopy
|
||||
}
|
||||
}
|
||||
tr.attr('data-share-permissions', sharePermissions)
|
||||
tr.attr('data-share-attributes', JSON.stringify(fileData.shareAttributes))
|
||||
if (fileData.shareOwner) {
|
||||
|
|
|
|||
4
dist/files_sharing-additionalScripts.js
vendored
4
dist/files_sharing-additionalScripts.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-additionalScripts.js.map
vendored
2
dist/files_sharing-additionalScripts.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files_sharing-files_sharing.js
vendored
4
dist/files_sharing-files_sharing.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-files_sharing.js.map
vendored
2
dist/files_sharing-files_sharing.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue