From f341ac263755c105e083a1533197a4e7006f524e Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 1 Oct 2019 10:59:26 +0200 Subject: [PATCH] Enable teams by default --- www/common/common-ui-elements.js | 72 +++++++++++++++---------------- www/common/sframe-common-outer.js | 1 - www/share/main.js | 1 - www/teams/inner.js | 4 -- 4 files changed, 34 insertions(+), 44 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 484c21f22..26b848ca9 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -241,22 +241,20 @@ define([ }); $div.append(addCol.div); - if (priv.enableTeams) { - var teamsData = Util.tryParse(JSON.stringify(priv.teams)) || {}; - Object.keys(teamsData).forEach(function (id) { - var t = teamsData[id]; - t.teamId = id; - if (owners.indexOf(t.edPublic) !== -1 || pending_owners.indexOf(t.edPublic) !== -1) { - delete teamsData[id]; - } - }); - var teamsList = UIElements.getUserGrid(Messages.owner_addTeamText, { - common: common, - noFilter: true, - data: teamsData - }, function () {}); - $div.append(teamsList.div); - } + var teamsData = Util.tryParse(JSON.stringify(priv.teams)) || {}; + Object.keys(teamsData).forEach(function (id) { + var t = teamsData[id]; + t.teamId = id; + if (owners.indexOf(t.edPublic) !== -1 || pending_owners.indexOf(t.edPublic) !== -1) { + delete teamsData[id]; + } + }); + var teamsList = UIElements.getUserGrid(Messages.owner_addTeamText, { + common: common, + noFilter: true, + data: teamsData + }, function () {}); + $div.append(teamsList.div); // When clicking on the add button, we get the selected users. var addButton = h('button.no-margin', Messages.owner_addButton); @@ -865,27 +863,25 @@ define([ var privateData = common.getMetadataMgr().getPrivateData(); var teamsData = Util.tryParse(JSON.stringify(privateData.teams)) || {}; var teams = {}; - if (privateData.enableTeams) { - Object.keys(teamsData).forEach(function (id) { - // config.teamId only exists when we're trying to share a pad from a team drive - // In this case, we don't want to share the pad with the current team - 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.getUserGrid(Messages.share_linkTeam, { - common: common, - noFilter: true, - data: teams - }, refreshButtons); - $div.append(teamsList.div); - } + Object.keys(teamsData).forEach(function (id) { + // config.teamId only exists when we're trying to share a pad from a team drive + // In this case, we don't want to share the pad with the current team + 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.getUserGrid(Messages.share_linkTeam, { + common: common, + noFilter: true, + data: teams + }, refreshButtons); + $div.append(teamsList.div); var shareButtons = [{ className: 'primary cp-share-with-friends', @@ -3004,7 +3000,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 && privateData.enableTeams) { + if (teamExists) { var teams = Object.keys(privateData.teams).map(function (id) { var data = privateData.teams[id]; var avatar = h('span.cp-creation-team-avatar.cp-avatar'); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 78f96ffdf..a2c909c50 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -321,7 +321,6 @@ 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/share/main.js b/www/share/main.js index 5e541a9eb..43e514f58 100644 --- a/www/share/main.js +++ b/www/share/main.js @@ -94,7 +94,6 @@ define([ password: config.data.password, isTemplate: config.data.isTemplate, file: config.data.file, - enableTeams: localStorage.CryptPad_teams === "1", }; for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; } diff --git a/www/teams/inner.js b/www/teams/inner.js index 4fa227dd3..d5c02741b 100644 --- a/www/teams/inner.js +++ b/www/teams/inner.js @@ -829,10 +829,6 @@ define([ 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();