From 9c0e1d8252b15ec6319cabf3b0b46f19aa015669 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 2 Jul 2021 18:16:34 +0200 Subject: [PATCH] Pending remote group share fixes Only remove reject share for remote group shares Also fix share indicator to appear for remote group shares as well. Fix pending remote share icon to be the one of a share. Signed-off-by: Vincent Petry --- apps/files_sharing/js/app.js | 4 +++- apps/files_sharing/js/sharedfilelist.js | 8 +++++++- apps/files_sharing/src/share.js | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js index 64db7fac692..b384946e5c8 100644 --- a/apps/files_sharing/js/app.js +++ b/apps/files_sharing/js/app.js @@ -316,7 +316,9 @@ OCA.Sharing.App = { iconClass: 'icon-close', type: OCA.Files.FileActions.TYPE_INLINE, shouldRender(context) { - if (context.$file.attr('data-remote-id')) { + // disable rejecting group shares from the pending list because they anyway + // land back into that same list + if (context.$file.attr('data-remote-id') && parseInt(context.$file.attr('data-share-type'), 10) === OC.Share.SHARE_TYPE_REMOTE_GROUP) { return false } return true diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js index bffc71d7a07..17c72db1ffc 100644 --- a/apps/files_sharing/js/sharedfilelist.js +++ b/apps/files_sharing/js/sharedfilelist.js @@ -100,6 +100,10 @@ $tr.attr('data-remote-id', fileData.remoteId) } + if (fileData.shareType) { + $tr.attr('data-share-type', fileData.shareType) + } + // add row with expiration date for link only shares - influenced by _createRow of filelist if (this._linksOnly) { var expirationTimestamp = 0 @@ -333,6 +337,8 @@ mtime: share.mtime * 1000, mimetype: share.mimetype, type: share.type, + // remote share types are different and need to be mapped + shareType: (parseInt(share.share_type, 10) === 1) ? OC.Share.SHARE_TYPE_REMOTE_GROUP : OC.Share.SHARE_TYPE_REMOTE, id: share.file_id, path: OC.dirname(share.mountpoint), permissions: share.permissions, @@ -351,7 +357,7 @@ if (!file.type) { // pending shares usually have no type, so default to showing a directory icon - file.mimetype = 'httpd/unix-directory' + file.mimetype = 'dir-shared' } file.shares = [{ diff --git a/apps/files_sharing/src/share.js b/apps/files_sharing/src/share.js index 385d42eaaea..bb160f8715d 100644 --- a/apps/files_sharing/src/share.js +++ b/apps/files_sharing/src/share.js @@ -181,6 +181,8 @@ import escapeHTML from 'escape-html' hasShares = true } else if (shareType === OC.Share.SHARE_TYPE_REMOTE) { hasShares = true + } else if (shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP) { + hasShares = true } else if (shareType === OC.Share.SHARE_TYPE_CIRCLE) { hasShares = true } else if (shareType === OC.Share.SHARE_TYPE_ROOM) {