summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-06-20 20:32:19 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-05 12:43:57 +0200
commitd86c1e95030ebd613348f36d62984ecd842c2618 (patch)
treeeccc74b0e3510ea60bf1cdb3ae93466ecfe1e49b /apps/files_sharing
parent3b835d8076c844adde1014e994256740c790857b (diff)
downloadnextcloud-server-d86c1e95030ebd613348f36d62984ecd842c2618.tar.gz
nextcloud-server-d86c1e95030ebd613348f36d62984ecd842c2618.zip
Disable sidebar on deleted share
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/js/app.js10
-rw-r--r--apps/files_sharing/js/share.js16
-rw-r--r--apps/files_sharing/js/sharedfilelist.js4
-rw-r--r--apps/files_sharing/lib/Controller/DeletedShareAPIController.php2
4 files changed, 23 insertions, 9 deletions
diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js
index 01857e4f262..f63410bc9bf 100644
--- a/apps/files_sharing/js/app.js
+++ b/apps/files_sharing/js/app.js
@@ -194,11 +194,11 @@ OCA.Sharing.App = {
actionHandler: function(fileName, context) {
var shareId = context.$file.data('shareId');
$.post(OC.linkToOCS('apps/files_sharing/api/v1/deletedshares', 2) + shareId)
- .success(function(result) {
- context.fileList.remove(context.fileInfoModel.attributes.name);
- }).fail(function() {
- OC.Notification.showTemporary(t('files_sharing', 'Something happened. Unable to restore the share.'));
- });
+ .success(function(result) {
+ context.fileList.remove(context.fileInfoModel.attributes.name);
+ }).fail(function() {
+ OC.Notification.showTemporary(t('files_sharing', 'Something happened. Unable to restore the share.'));
+ });
}
});
return fileActions;
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 22513e1b470..5f7705a8369 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -42,6 +42,12 @@
var fileActions = fileList.fileActions;
var oldCreateRow = fileList._createRow;
fileList._createRow = function(fileData) {
+
+ if (fileData.permissions === 0) {
+ // no permission, disabling sidebar
+ delete fileActions.actions.all.Details;
+ }
+
var tr = oldCreateRow.apply(this, arguments);
var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData);
tr.attr('data-share-permissions', sharePermissions);
@@ -158,11 +164,15 @@
permissions: OC.PERMISSION_ALL,
iconClass: 'icon-shared',
type: OCA.Files.FileActions.TYPE_INLINE,
- actionHandler: function(fileName) {
- fileList.showDetailsView(fileName, 'shareTabView');
+ actionHandler: function(fileName, context) {
+ // do not open sidebar if no permission on the file
+ var permissions = parseInt(context.$file.data('share-permissions'), 10);
+ if (permissions > 0) {
+ fileList.showDetailsView(fileName, 'shareTabView');
+ }
},
render: function(actionSpec, isDefault, context) {
- var permissions = parseInt(context.$file.attr('data-permissions'), 10);
+ var permissions = parseInt(context.$file.data('permissions'), 10);
// if no share permissions but share owner exists, still show the link
if ((permissions & OC.PERMISSION_SHARE) !== 0 || context.$file.attr('data-share-owner')) {
return fileActions._defaultRenderAction.call(fileActions, actionSpec, isDefault, context);
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index aaa04ca12f1..973d2120b16 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -82,6 +82,10 @@
var permission = parseInt($tr.attr('data-permissions')) | OC.PERMISSION_DELETE;
$tr.attr('data-permissions', permission);
}
+ if (this._showDeleted) {
+ var permission = fileData.permissions;
+ $tr.attr('data-share-permissions', permission);
+ }
// add row with expiration date for link only shares - influenced by _createRow of filelist
if (this._linksOnly) {
diff --git a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php
index bd00d1a261b..3c352c1c022 100644
--- a/apps/files_sharing/lib/Controller/DeletedShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/DeletedShareAPIController.php
@@ -79,7 +79,7 @@ class DeletedShareAPIController extends OCSController {
'share_type' => $share->getShareType(),
'uid_owner' => $share->getSharedBy(),
'displayname_owner' => $this->userManager->get($share->getSharedBy())->getDisplayName(),
- 'permissions' => $share->getPermissions(),
+ 'permissions' => 0,
'stime' => $share->getShareTime()->getTimestamp(),
'parent' => null,
'expiration' => null,