Remove "Reject share" for pending remote shares

In the list of pending shares, the option for rejecting the share has
been removed.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
Vincent Petry 2021-07-02 17:42:55 +02:00
parent 7130a98e47
commit 46b8cf4f64
No known key found for this signature in database
GPG key ID: E055D6A4D513575C
4 changed files with 18 additions and 3 deletions

View file

@ -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) {

View file

@ -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'

View file

@ -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

View file

@ -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
}