Disable sidebar on deleted share
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
3b835d8076
commit
d86c1e9503
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue