summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2024-05-16 09:55:01 +0200
committerChristopher Ng <chrng8@gmail.com>2024-05-22 11:10:50 -0700
commitc8003e480b2320c998d7c088eeeaac1a72fe2af2 (patch)
treef2a456d67f531d3d57300b84685944aef34e506c /apps/files
parent51adff2755df38ca598a7d9ac63d2efd0c840502 (diff)
downloadnextcloud-server-c8003e480b2320c998d7c088eeeaac1a72fe2af2.tar.gz
nextcloud-server-c8003e480b2320c998d7c088eeeaac1a72fe2af2.zip
fix: Keep download action for files and hide only for relevant files
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/fileactions.js14
-rw-r--r--apps/files/js/fileactionsmenu.js6
2 files changed, 20 insertions, 0 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index ec09ec1bb8c..fc79d63687f 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -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;
}
});
diff --git a/apps/files/js/fileactionsmenu.js b/apps/files/js/fileactionsmenu.js
index 7eecf209984..f6166c22e27 100644
--- a/apps/files/js/fileactionsmenu.js
+++ b/apps/files/js/fileactionsmenu.js
@@ -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) {