diff options
author | Azul <azul@riseup.net> | 2020-04-06 09:41:36 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2020-04-08 18:19:58 +0200 |
commit | d2728cbdc13e89f11dc2b8c48b6148d6e89d0c83 (patch) | |
tree | 38decca5dc041c9f31d2233f4b6d13cd87549d9c /apps/files/js/fileactions.js | |
parent | cb2b38516f2a5e98400e5ed2cbcd17ceeb269b9b (diff) | |
download | nextcloud-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/js/fileactions.js')
-rw-r--r-- | apps/files/js/fileactions.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 24f8279116d..404b6f1877e 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -257,13 +257,26 @@ }, /** + * Returns the default file action handler for the current file + * + * @return {OCA.Files.FileActions~actionSpec} action spec + * @since 8.2 + */ + getCurrentDefaultFileAction: function() { + var mime = this.getCurrentMimeType(); + var type = this.getCurrentType(); + var permissions = this.getCurrentPermissions(); + return this.getDefaultFileAction(mime,type, permissions); + }, + + /** * Returns the default file action handler for the given conditions * * @param {string} mime mime type * @param {string} type "dir" or "file" * @param {int} permissions permissions * - * @return {OCA.Files.FileActions~actionHandler} action handler + * @return {OCA.Files.FileActions~actionSpec} action spec * @since 8.2 */ getDefaultFileAction: function(mime, type, permissions) { |