Disable shared folders creation by default

pull/1/head
yflory 6 years ago
parent f2baaf5b5b
commit 20a9eee719

@ -126,5 +126,11 @@ define(function() {
// Warning: This is an experimental feature. It will be enabled by default once we're sure it's stable. // Warning: This is an experimental feature. It will be enabled by default once we're sure it's stable.
config.disableWorkers = true; config.disableWorkers = true;
// Shared folder are in a beta-test state. They are likely to disappear from a user's drive
// spontaneously, resulting in the deletion of the entire folder's content.
// We highly recommend to keep them disabled until they are stable enough to be enabled
// by default by the CryptPad developers.
config.disableSharedFolders = true;
return config; return config;
}); });

@ -267,6 +267,7 @@ define([
forceCreationScreen: forceCreationScreen, forceCreationScreen: forceCreationScreen,
password: password, password: password,
channel: secret.channel, channel: secret.channel,
enableSF: localStorage.CryptPad_SF === "1" // TODO to remove when enabled by default
}; };
for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; } for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }

@ -42,7 +42,7 @@ define([
var APP = window.APP = { var APP = window.APP = {
editable: false, editable: false,
mobile: function () { return $('body').width() <= 600; }, // Menu and content area are not inline-block anymore for mobiles mobile: function () { return $('body').width() <= 600; }, // Menu and content area are not inline-block anymore for mobiles
isMac: navigator.platform === "MacIntel" isMac: navigator.platform === "MacIntel",
}; };
var stringify = function (obj) { var stringify = function (obj) {
@ -797,7 +797,7 @@ define([
if (className === 'newfolder') { return; } if (className === 'newfolder') { return; }
if (className === 'newsharedfolder') { if (className === 'newsharedfolder') {
// Hide the new shared folder menu if we're already in a shared folder // Hide the new shared folder menu if we're already in a shared folder
return manager.isInSharedFolder(currentPath); return manager.isInSharedFolder(currentPath) || APP.disableSF;
} }
return AppConfig.availablePadTypes.indexOf($el.attr('data-type')) === -1; return AppConfig.availablePadTypes.indexOf($el.attr('data-type')) === -1;
}; };
@ -1775,7 +1775,7 @@ define([
.click(function () { .click(function () {
manager.addFolder(currentPath, null, onCreated); manager.addFolder(currentPath, null, onCreated);
}); });
if (!manager.isInSharedFolder(currentPath)) { if (!APP.disableSF && !manager.isInSharedFolder(currentPath)) {
$block.find('a.cp-app-drive-new-shared-folder, li.cp-app-drive-new-shared-folder') $block.find('a.cp-app-drive-new-shared-folder, li.cp-app-drive-new-shared-folder')
.click(function () { .click(function () {
addSharedFolderModal(function (obj) { addSharedFolderModal(function (obj) {
@ -1823,7 +1823,7 @@ define([
attributes: {'class': 'cp-app-drive-new-folder'}, attributes: {'class': 'cp-app-drive-new-folder'},
content: $('<div>').append($folderIcon.clone()).html() + Messages.fm_folder content: $('<div>').append($folderIcon.clone()).html() + Messages.fm_folder
}); });
if (!manager.isInSharedFolder(currentPath)) { if (!APP.disableSF && !manager.isInSharedFolder(currentPath)) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'cp-app-drive-new-shared-folder'}, attributes: {'class': 'cp-app-drive-new-shared-folder'},
@ -2100,7 +2100,7 @@ define([
$element1.append($('<span>', { 'class': 'cp-app-drive-new-name' }) $element1.append($('<span>', { 'class': 'cp-app-drive-new-name' })
.text(Messages.fm_folder)); .text(Messages.fm_folder));
// Shared Folder // Shared Folder
if (!manager.isInSharedFolder(currentPath)) { if (!APP.disableSF && !manager.isInSharedFolder(currentPath)) {
var $element3 = $('<li>', { var $element3 = $('<li>', {
'class': 'cp-app-drive-new-shared-folder cp-app-drive-element-row ' + 'class': 'cp-app-drive-new-shared-folder cp-app-drive-element-row ' +
'cp-app-drive-element-grid' 'cp-app-drive-element-grid'
@ -3353,6 +3353,9 @@ define([
}).nThen(function () { }).nThen(function () {
var sframeChan = common.getSframeChannel(); var sframeChan = common.getSframeChannel();
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
APP.disableSF = !metadataMgr.getPrivateData().enableSF && AppConfig.disableSharedFolders;
var configTb = { var configTb = {
displayed: ['useradmin', 'pageTitle', 'newpad', 'limit'], displayed: ['useradmin', 'pageTitle', 'newpad', 'limit'],
pageTitle: Messages.type.drive, pageTitle: Messages.type.drive,

Loading…
Cancel
Save