From b6c5403050ce7d1a5c6c15b4fc5e75ca8816eb2e Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 23 Sep 2019 11:52:13 +0200 Subject: [PATCH] Hide the team app behind a flag --- www/common/common-ui-elements.js | 38 ++++++++++++++++--------------- www/common/sframe-common-outer.js | 1 + www/team/inner.js | 9 ++++++-- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 109363cc1..d850d6532 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -757,23 +757,25 @@ define([ var privateData = common.getMetadataMgr().getPrivateData(); var teamsData = Util.tryParse(JSON.stringify(privateData.teams)) || {}; var teams = {}; - Object.keys(teamsData).forEach(function (id) { - if (config.teamId && config.teamId === id) { return; } - var t = teamsData[id]; - teams[t.edPublic] = { - notifications: true, - displayName: t.name, - edPublic: t.edPublic, - avatar: t.avatar, - id: id - }; - }); - var teamsList = UIElements.getFriendsList('Share with a team', { - common: common, - noFilter: true, - friends: teams - }, refreshButtons); - $div.append(teamsList.div); + if (privateData.enableTeams) { + Object.keys(teamsData).forEach(function (id) { + if (config.teamId && config.teamId === id) { return; } + var t = teamsData[id]; + teams[t.edPublic] = { + notifications: true, + displayName: t.name, + edPublic: t.edPublic, + avatar: t.avatar, + id: id + }; + }); + var teamsList = UIElements.getFriendsList('Share with a team', { + common: common, + noFilter: true, + friends: teams + }, refreshButtons); + $div.append(teamsList.div); + } var shareButtons = [{ className: 'primary cp-share-with-friends', @@ -2877,7 +2879,7 @@ define([ // * a team ID ==> store in the team drive, and the team will be the owner // * -1 ==> store in the user drive, and the user will be the owner // * undefined ==> ask - if (teamExists) { + if (teamExists && privateData.enableTeams) { var teamOptions = Object.keys(privateData.teams).map(function (teamId) { var t = privateData.teams[teamId]; return { diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 52f6f017e..5bfd8f898 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -321,6 +321,7 @@ define([ password: password, channel: secret.channel, enableSF: localStorage.CryptPad_SF === "1", // TODO to remove when enabled by default + enableTeams: localStorage.CryptPad_teams === "1", devMode: localStorage.CryptPad_dev === "1", fromFileData: Cryptpad.fromFileData ? { title: Cryptpad.fromFileData.title diff --git a/www/team/inner.js b/www/team/inner.js index 1635248ce..c9a0ff4ca 100644 --- a/www/team/inner.js +++ b/www/team/inner.js @@ -685,12 +685,17 @@ define([ var sframeChan = common.getSframeChannel(); var metadataMgr = common.getMetadataMgr(); var privateData = metadataMgr.getPrivateData(); + + if (!privateData.enableTeams) { + return void UI.errorLoadingScreen(Messages.comingSoon); + } + readOnly = driveAPP.readOnly = metadataMgr.getPrivateData().readOnly; driveAPP.loggedIn = common.isLoggedIn(); if (!driveAPP.loggedIn) { throw new Error('NOT_LOGGED_IN'); } - common.setTabTitle('TEAMS'); // XXX + common.setTabTitle('TEAMS (ALPHA)'); // XXX // Drive data if (privateData.newSharedFolder) { @@ -702,7 +707,7 @@ define([ var $bar = $('#cp-toolbar'); var configTb = { displayed: ['useradmin', 'pageTitle', 'newpad', 'limit', 'notifications'], - pageTitle: 'TEAMS', // XXX + pageTitle: 'TEAMS (ALPHA)', // XXX metadataMgr: metadataMgr, readOnly: privateData.readOnly, sfCommon: common,