From 20a9eee719f737457135c016162bd2fbed48fc50 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 20 Jul 2018 18:41:14 +0200 Subject: [PATCH] Disable shared folders creation by default --- www/common/application_config_internal.js | 6 ++++++ www/common/sframe-common-outer.js | 1 + www/drive/inner.js | 13 ++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index e3ab72b91..7539fb0db 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -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. 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; }); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index bb86c44f4..ec3bf03fe 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -267,6 +267,7 @@ define([ forceCreationScreen: forceCreationScreen, password: password, 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]; } diff --git a/www/drive/inner.js b/www/drive/inner.js index fcda6bd7f..fd2a14c0a 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -42,7 +42,7 @@ define([ var APP = window.APP = { editable: false, 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) { @@ -797,7 +797,7 @@ define([ if (className === 'newfolder') { return; } if (className === 'newsharedfolder') { // 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; }; @@ -1775,7 +1775,7 @@ define([ .click(function () { 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') .click(function () { addSharedFolderModal(function (obj) { @@ -1823,7 +1823,7 @@ define([ attributes: {'class': 'cp-app-drive-new-folder'}, content: $('
').append($folderIcon.clone()).html() + Messages.fm_folder }); - if (!manager.isInSharedFolder(currentPath)) { + if (!APP.disableSF && !manager.isInSharedFolder(currentPath)) { options.push({ tag: 'a', attributes: {'class': 'cp-app-drive-new-shared-folder'}, @@ -2100,7 +2100,7 @@ define([ $element1.append($('', { 'class': 'cp-app-drive-new-name' }) .text(Messages.fm_folder)); // Shared Folder - if (!manager.isInSharedFolder(currentPath)) { + if (!APP.disableSF && !manager.isInSharedFolder(currentPath)) { var $element3 = $('
  • ', { 'class': 'cp-app-drive-new-shared-folder cp-app-drive-element-row ' + 'cp-app-drive-element-grid' @@ -3353,6 +3353,9 @@ define([ }).nThen(function () { var sframeChan = common.getSframeChannel(); var metadataMgr = common.getMetadataMgr(); + + APP.disableSF = !metadataMgr.getPrivateData().enableSF && AppConfig.disableSharedFolders; + var configTb = { displayed: ['useradmin', 'pageTitle', 'newpad', 'limit'], pageTitle: Messages.type.drive,