aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/fileactions.js
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-07-28 10:38:23 +0200
committerGitHub <noreply@github.com>2021-07-28 10:38:23 +0200
commita71294ed34ee2906ade9982258f6fcb07dd43adc (patch)
treeea0de50f38fa7f3a5a750d357c064166e1748d0c /apps/files/js/fileactions.js
parent640f339b7d99a961abb8692537ce41f9db9d4b05 (diff)
parentf6f2f63016e8183c7054fb28007a7d51666d8475 (diff)
downloadnextcloud-server-a71294ed34ee2906ade9982258f6fcb07dd43adc.tar.gz
nextcloud-server-a71294ed34ee2906ade9982258f6fcb07dd43adc.zip
Merge pull request #27751 from nextcloud/enh/23769/accept-decline-fed-sharing-ui
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r--apps/files/js/fileactions.js8
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) {