Remove edit actions in read-only shared folder context menu

pull/1/head
yflory 5 years ago
parent f44e6f9719
commit 5290bcf791

@ -1122,6 +1122,10 @@ define([
paths.forEach(function (p) {
var path = p.path;
var $element = p.element;
if (APP.$content.data('readOnlyFolder') &&
manager.isSubpath(path, currentPath)) { editable = false; }
if (!$element.closest("#cp-app-drive-tree").length) {
hide.push('expandall');
hide.push('collapseall');
@ -1267,6 +1271,7 @@ define([
show.forEach(function (className) {
var $el = $contextMenu.find('.cp-app-drive-context-' + className);
if ((!APP.editable || !editable) && $el.is('.cp-app-drive-context-editable')) { return; }
if ((!APP.editable || !editable) && $el.is('.cp-app-drive-context-editable')) { return; }
if (filter($el, className)) { return; }
$el.parent('li').show();
filtered.push('.cp-app-drive-context-' + className);
@ -1876,6 +1881,7 @@ define([
if (!element || !manager.isFolder(element)) { return; }
// The element with the class '.name' is underlined when the 'li' is hovered
var $state = $('<span>', {'class': 'cp-app-drive-element-state'});
var $ro;
if (manager.isSharedFolder(element)) {
var data = manager.getSharedFolderData(element);
key = data && data.title ? data.title : key;
@ -1889,14 +1895,14 @@ define([
$password.attr('title', Messages.fm_passwordProtected || '');
}
if (hrefData.hashData && hrefData.hashData.mode === 'view') {
var $ro = $readonlyIcon.clone().appendTo($state);
$ro = $readonlyIcon.clone().appendTo($state);
$ro.attr('title', Messages.readonly);
}
var $shared = $sharedIcon.clone().appendTo($state);
$shared.attr('title', Messages.fm_canBeShared);
} else if ($content.data('readOnlyFolder') || APP.readOnly) {
var $ro = $readonlyIcon.clone().appendTo($state);
$ro = $readonlyIcon.clone().appendTo($state);
$ro.attr('title', Messages.readonly);
}

Loading…
Cancel
Save