From 1a0f06f860c43d8ce0c3caabbf893f9a18c5f197 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 4 Mar 2021 18:40:38 +0100 Subject: [PATCH] Fix userlist in non-degraded apps --- www/common/onlyoffice/inner.js | 1 + www/common/sframe-app-framework.js | 2 ++ www/common/toolbar.js | 12 ++++-------- www/poll/inner.js | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index fb864f1e5..1432decb3 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -2200,6 +2200,7 @@ define([ config.onInit = function (info) { var privateData = metadataMgr.getPrivateData(); + metadataMgr.setDegraded(false); // FIXME degraded moded unsupported (no cursor channel) readOnly = privateData.readOnly; diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 802bdc341..20d57fd07 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -585,6 +585,8 @@ define([ var hjson = normalize(JSON.parse(newContentStr)); evCursorUpdate.fire(data, hjson); }); + } else { + common.getMetadataMgr().setDegraded(false); } UI.removeLoadingScreen(emitResize); diff --git a/www/common/toolbar.js b/www/common/toolbar.js index ccb82a2d8..dd79f24a9 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -216,11 +216,11 @@ MessengerUI, Messages) { $('').text(Messages.userlist_offline).appendTo($editUsersList); numberOfEditUsers = '?'; numberOfViewUsers = '?'; - } - - if (metadataMgr.isDegraded()) { + } else if (metadataMgr.isDegraded()) { numberOfEditUsers = Math.max(metadataMgr.getChannelMembers().length - 1, 0); numberOfViewUsers = ''; + Messages.toolbar_degraded = "Too many editors are present in the pad. The userlist has been disabled to improve performances"; // XXX + $('').text(Messages.toolbar_degraded).appendTo($editUsersList); } // Update the buttons @@ -231,11 +231,7 @@ MessengerUI, Messages) { if (!online) { return; } - if (metadataMgr.isDegraded()) { - Messages.toolbar_degraded = "Too many editors are present in the pad. The userlist has been disabled to improve performances"; // XXX - $('').text(Messages.toolbar_degraded).appendTo($editUsersList); - return; - } + if (metadataMgr.isDegraded()) { return; } // Display the userlist diff --git a/www/poll/inner.js b/www/poll/inner.js index 101c89e7e..5d31d917d 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -1313,6 +1313,7 @@ define([ }).nThen(function (/* waitFor */) { Test.registerInner(common.getSframeChannel()); var metadataMgr = common.getMetadataMgr(); + metadataMgr.setDegraded(false); // FIXME degarded mode unsupported (no cursor channel) APP.locked = APP.readOnly = metadataMgr.getPrivateData().readOnly; APP.loggedIn = common.isLoggedIn();