aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/public.js
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2020-04-06 09:41:36 +0200
committerAzul <azul@riseup.net>2020-04-08 18:19:58 +0200
commitd2728cbdc13e89f11dc2b8c48b6148d6e89d0c83 (patch)
tree38decca5dc041c9f31d2233f4b6d13cd87549d9c /apps/files_sharing/js/public.js
parentcb2b38516f2a5e98400e5ed2cbcd17ceeb269b9b (diff)
downloadnextcloud-server-d2728cbdc13e89f11dc2b8c48b6148d6e89d0c83.tar.gz
nextcloud-server-d2728cbdc13e89f11dc2b8c48b6148d6e89d0c83.zip
refactor: fileActions.getCurrentDefaultFileAction()
fileActions.getCurrentDefaultFileAction() returns the default file action for the currently selected file. There were a number of places querying for the mime, type and permissions of that file first to then query for the default action. Signed-off-by: Azul <azul@riseup.net>
Diffstat (limited to 'apps/files_sharing/js/public.js')
-rw-r--r--apps/files_sharing/js/public.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 042cc6c056e..aba7bbc029e 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -113,8 +113,8 @@ OCA.Sharing.PublicApp = {
// Show file preview if previewer is available, images are already handled by the template
if (mimetype.substr(0, mimetype.indexOf('/')) !== 'image' && $('.publicpreview').length === 0) {
// Trigger default action if not download TODO
- var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ);
- if (typeof action !== 'undefined') {
+ var action = FileActions.getDefaultFileAction(mimetype, 'file', OC.PERMISSION_READ);
+ if (action && action.action) {
action($('#filename').val());
}
}
@@ -204,10 +204,6 @@ OCA.Sharing.PublicApp = {
var $tr = OCA.Files.FileList.prototype._createRow.apply(this, arguments);
if (hideDownload === 'true') {
this.fileActions.currentFile = $tr.find('td');
- var mime = this.fileActions.getCurrentMimeType();
- var type = this.fileActions.getCurrentType();
- var permissions = this.fileActions.getCurrentPermissions();
- var action = this.fileActions.getDefault(mime, type, permissions);
// Remove the link. This means that files without a default action fail hard
$tr.find('a.name').attr('href', '#');