diff options
author | Daniel Rudolf <github.com@daniel-rudolf.de> | 2021-08-04 18:52:55 +0200 |
---|---|---|
committer | Daniel Rudolf <github.com@daniel-rudolf.de> | 2021-08-04 18:52:55 +0200 |
commit | aa455e71d95c877b0dc758bc5c873d9278e6e112 (patch) | |
tree | 6f1135402c356f68cd940e0b2ca5efd1f8d91a67 /apps/files/js/fileactions.js | |
parent | b768cade2b2c6664851de6462a17ef3531305971 (diff) | |
parent | 2a632195365be77889428e85801a00c74ab6a836 (diff) | |
download | nextcloud-server-aa455e71d95c877b0dc758bc5c873d9278e6e112.tar.gz nextcloud-server-aa455e71d95c877b0dc758bc5c873d9278e6e112.zip |
Merge branch 'master' into enhancement/noid/IURLGenerator-linkToDefaultPageUrl
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r-- | apps/files/js/fileactions.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index c7883e4d2a6..5d9e8578e19 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -155,6 +155,9 @@ if (_.isFunction(action.render)) { actionSpec.render = action.render; } + if (_.isFunction(action.shouldRender)) { + actionSpec.shouldRender = action.shouldRender; + } if (!this.actions[mime]) { this.actions[mime] = {}; } @@ -397,6 +400,11 @@ * @param {OCA.Files.FileActionContext} context rendering context */ _renderInlineAction: function(actionSpec, isDefault, context) { + if (actionSpec.shouldRender) { + if (!actionSpec.shouldRender(context)) { + return; + } + } var renderFunc = actionSpec.render || _.bind(this._defaultRenderAction, this); var $actionEl = renderFunc(actionSpec, isDefault, context); if (!$actionEl || !$actionEl.length) { |