mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
fix: Keep download action for files and hide only for relevant files
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
51adff2755
commit
c8003e480b
3 changed files with 20 additions and 13 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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue