diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index 496e65f1f..f91c73f56 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -179,5 +179,16 @@ define(function() { // You can change the value here. // config.maxOwnedTeams = 5; + // The userlist displayed in collaborative documents is stored alongside the document data. + // Everytime someone with edit rights joins a document or modify their user data (display + // name, avatar, color, etc.), they update the "userlist" part of the document. When too many + // editors are in the same document, all these changes increase the risks of conflicts which + // require CPU time to solve. A "degraded" mode can now be set when a certain number of editors + // are in a document at the same time. This mode disables the userlist, the chat and the + // position of other users' cursor. You can configure the number of user from which the session + // will enter into degraded mode. A big number may result in collaborative edition being broken, + // but this number depends on the network and CPU performances of each user's device. + config.degradedLimit = 8; + return config; }); diff --git a/www/common/outer/cursor.js b/www/common/outer/cursor.js index 8338fef16..371a4565e 100644 --- a/www/common/outer/cursor.js +++ b/www/common/outer/cursor.js @@ -2,11 +2,13 @@ define([ '/common/common-util.js', '/common/common-constants.js', '/customize/messages.js', + '/customize/application_config.js', '/bower_components/chainpad-crypto/crypto.js', -], function (Util, Constants, Messages, Crypto) { +], function (Util, Constants, Messages, AppConfig, Crypto) { var Cursor = {}; - var DEGRADED = 3; // XXX Number of users before switching to degraded mode + var DEGRADED = AppConfig.degradedLimit || 8; +console.log(DEGRADED); var convertToUint8 = function (obj) { var l = Object.keys(obj).length;