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 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 {

@ -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

@ -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,

Loading…
Cancel
Save