Hide the team app behind a flag

pull/1/head
yflory 5 years ago
parent 97efaf2417
commit b6c5403050

@ -757,23 +757,25 @@ define([
var privateData = common.getMetadataMgr().getPrivateData(); var privateData = common.getMetadataMgr().getPrivateData();
var teamsData = Util.tryParse(JSON.stringify(privateData.teams)) || {}; var teamsData = Util.tryParse(JSON.stringify(privateData.teams)) || {};
var teams = {}; var teams = {};
Object.keys(teamsData).forEach(function (id) { if (privateData.enableTeams) {
if (config.teamId && config.teamId === id) { return; } Object.keys(teamsData).forEach(function (id) {
var t = teamsData[id]; if (config.teamId && config.teamId === id) { return; }
teams[t.edPublic] = { var t = teamsData[id];
notifications: true, teams[t.edPublic] = {
displayName: t.name, notifications: true,
edPublic: t.edPublic, displayName: t.name,
avatar: t.avatar, edPublic: t.edPublic,
id: id avatar: t.avatar,
}; id: id
}); };
var teamsList = UIElements.getFriendsList('Share with a team', { });
common: common, var teamsList = UIElements.getFriendsList('Share with a team', {
noFilter: true, common: common,
friends: teams noFilter: true,
}, refreshButtons); friends: teams
$div.append(teamsList.div); }, refreshButtons);
$div.append(teamsList.div);
}
var shareButtons = [{ var shareButtons = [{
className: 'primary cp-share-with-friends', 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 // * 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 // * -1 ==> store in the user drive, and the user will be the owner
// * undefined ==> ask // * undefined ==> ask
if (teamExists) { if (teamExists && privateData.enableTeams) {
var teamOptions = Object.keys(privateData.teams).map(function (teamId) { var teamOptions = Object.keys(privateData.teams).map(function (teamId) {
var t = privateData.teams[teamId]; var t = privateData.teams[teamId];
return { return {

@ -321,6 +321,7 @@ define([
password: password, password: password,
channel: secret.channel, channel: secret.channel,
enableSF: localStorage.CryptPad_SF === "1", // TODO to remove when enabled by default enableSF: localStorage.CryptPad_SF === "1", // TODO to remove when enabled by default
enableTeams: localStorage.CryptPad_teams === "1",
devMode: localStorage.CryptPad_dev === "1", devMode: localStorage.CryptPad_dev === "1",
fromFileData: Cryptpad.fromFileData ? { fromFileData: Cryptpad.fromFileData ? {
title: Cryptpad.fromFileData.title title: Cryptpad.fromFileData.title

@ -685,12 +685,17 @@ define([
var sframeChan = common.getSframeChannel(); var sframeChan = common.getSframeChannel();
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData(); var privateData = metadataMgr.getPrivateData();
if (!privateData.enableTeams) {
return void UI.errorLoadingScreen(Messages.comingSoon);
}
readOnly = driveAPP.readOnly = metadataMgr.getPrivateData().readOnly; readOnly = driveAPP.readOnly = metadataMgr.getPrivateData().readOnly;
driveAPP.loggedIn = common.isLoggedIn(); driveAPP.loggedIn = common.isLoggedIn();
if (!driveAPP.loggedIn) { throw new Error('NOT_LOGGED_IN'); } if (!driveAPP.loggedIn) { throw new Error('NOT_LOGGED_IN'); }
common.setTabTitle('TEAMS'); // XXX common.setTabTitle('TEAMS (ALPHA)'); // XXX
// Drive data // Drive data
if (privateData.newSharedFolder) { if (privateData.newSharedFolder) {
@ -702,7 +707,7 @@ define([
var $bar = $('#cp-toolbar'); var $bar = $('#cp-toolbar');
var configTb = { var configTb = {
displayed: ['useradmin', 'pageTitle', 'newpad', 'limit', 'notifications'], displayed: ['useradmin', 'pageTitle', 'newpad', 'limit', 'notifications'],
pageTitle: 'TEAMS', // XXX pageTitle: 'TEAMS (ALPHA)', // XXX
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
readOnly: privateData.readOnly, readOnly: privateData.readOnly,
sfCommon: common, sfCommon: common,

Loading…
Cancel
Save