Make the number of teams and owned teams configurable

This commit is contained in:
yflory 2019-10-15 18:02:11 +02:00
parent e6eb3554d6
commit 8db0fcf8bd
3 changed files with 20 additions and 11 deletions

View file

@ -147,16 +147,24 @@ define(function() {
// Workers allow us to run the websockets connection and open the user drive in a separate thread.
// SharedWorkers allow us to load only one websocket and one user drive for all the browser tabs,
// making it much faster to open new tabs.
// Warning: This is an experimental feature. It will be enabled by default once we're sure it's stable.
config.disableWorkers = false;
// 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 = false;
config.surveyURL = "https://survey.cryptpad.fr/index.php/672782";
// Teams are always loaded during the initial loading screen (for the first tab only if
// SharedWorkers are available). Allowing users to be members of multiple teams can
// make them have a very slow loading time. To avoid impacting the user experience
// significantly, we're limiting the number of teams per user to 3 by default.
// You can change this value here.
//config.maxTeamsSlots = 3;
// Each team is considered as a registered user by the server. Users and teams are indistinguishable
// in the database so teams will offer the same storage limits as users by default.
// It means that each team created by a user can increase their storage limit by +100%.
// We're limiting the number of teams each user is able to own to 1 in order to make sure
// users don't use "fake" teams (1 member) just to increase their storage limit.
// You can change the value here.
// config.maxTeamsOwned = 1;
return config;
});

View file

@ -1,4 +1,4 @@
define(function () {
define(['/customize/application_config.js'], function (AppConfig) {
return {
// localStorage
userHashKey: 'User_hash',
@ -16,7 +16,8 @@ define(function () {
tokenKey: 'loginToken',
displayPadCreationScreen: 'displayPadCreationScreen',
deprecatedKey: 'deprecated',
MAX_TEAMS_SLOTS: 3,
MAX_TEAMS_SLOTS: AppConfig.maxTeamsSlots || 3,
MAX_TEAMS_OWNED: AppConfig.maxTeamsOwned || 1,
// Sub
plan: 'CryptPad_plan',
// Apps

View file

@ -372,9 +372,9 @@ define([
var privateData = metadataMgr.getPrivateData();
var content = [];
var isOwner = Object.keys(privateData.teams || {}).some(function (id) {
var isOwner = Object.keys(privateData.teams || {}).filter(function (id) {
return privateData.teams[id].owner;
}) && !privateData.devMode;
}).length >= Constants.MAX_TEAMS_OWNED; // && !privateData.devMode;
var getWarningBox = function () {
return h('div.alert.alert-warning', {