diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/fileactions.js | 8 | ||||
-rw-r--r-- | apps/files_sharing/js/app.js | 6 | ||||
-rw-r--r-- | apps/files_sharing/js/sharedfilelist.js | 4 | ||||
-rw-r--r-- | apps/files_sharing/src/share.js | 3 |
4 files changed, 18 insertions, 3 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) { diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js index 6af8224baf4..8fb5cb02e56 100644 --- a/apps/files_sharing/js/app.js +++ b/apps/files_sharing/js/app.js @@ -315,6 +315,12 @@ OCA.Sharing.App = { permissions: OC.PERMISSION_ALL, iconClass: 'icon-close', type: OCA.Files.FileActions.TYPE_INLINE, + shouldRender(context) { + if (context.$file.attr('data-remote-id')) { + return false + } + return true + }, actionHandler(fileName, context) { const shareId = context.$file.data('shareId') let shareBase = 'shares' diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js index 1f467f549d7..2afd8a21b31 100644 --- a/apps/files_sharing/js/sharedfilelist.js +++ b/apps/files_sharing/js/sharedfilelist.js @@ -96,6 +96,10 @@ $tr.attr('data-share-permissions', permission) } + if (fileData.remoteId) { + $tr.attr('data-remote-id', fileData.remoteId) + } + // add row with expiration date for link only shares - influenced by _createRow of filelist if (this._linksOnly) { var expirationTimestamp = 0 diff --git a/apps/files_sharing/src/share.js b/apps/files_sharing/src/share.js index ab41db7e8cd..385d42eaaea 100644 --- a/apps/files_sharing/src/share.js +++ b/apps/files_sharing/src/share.js @@ -104,9 +104,6 @@ import escapeHTML from 'escape-html' if (fileData.shareTypes) { tr.attr('data-share-types', fileData.shareTypes.join(',')) } - if (fileData.remoteId) { - tr.attr('data-remote-id', fileData.remoteId) - } return tr } |