From fcf1a142c4d87bf697eeaed509a880ee885c39c7 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Mon, 13 Feb 2023 14:37:25 -0300 Subject: [PATCH 1/2] Change setting to readonly --- apps/meteor/app/lib/server/startup/settings.ts | 2 +- .../views/admin/settings/inputs/BooleanSettingInput.tsx | 3 +-- ee/packages/presence/src/Presence.ts | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/meteor/app/lib/server/startup/settings.ts b/apps/meteor/app/lib/server/startup/settings.ts index 9d371b73d0b0..431df60295ae 100644 --- a/apps/meteor/app/lib/server/startup/settings.ts +++ b/apps/meteor/app/lib/server/startup/settings.ts @@ -3191,7 +3191,7 @@ settingsRegistry.addGroup('Troubleshoot', function () { this.add('Presence_broadcast_disabled', false, { type: 'boolean', public: true, - blocked: true, + readonly: true, }); this.add('Troubleshoot_Disable_Presence_Broadcast', false, { diff --git a/apps/meteor/client/views/admin/settings/inputs/BooleanSettingInput.tsx b/apps/meteor/client/views/admin/settings/inputs/BooleanSettingInput.tsx index 1a8728ac79c6..e7799473f752 100644 --- a/apps/meteor/client/views/admin/settings/inputs/BooleanSettingInput.tsx +++ b/apps/meteor/client/views/admin/settings/inputs/BooleanSettingInput.tsx @@ -36,8 +36,7 @@ function BooleanSettingInput({ id={_id} value='true' checked={value === true} - disabled={disabled} - readOnly={readonly} + disabled={disabled || readonly} onChange={handleChange} /> diff --git a/ee/packages/presence/src/Presence.ts b/ee/packages/presence/src/Presence.ts index 144f0b1395df..9bb29b011c26 100755 --- a/ee/packages/presence/src/Presence.ts +++ b/ee/packages/presence/src/Presence.ts @@ -31,8 +31,8 @@ export class Presence extends ServiceClass implements IPresence { return; } - // check total connections if there is no license - if (!this.hasLicense && diff?.hasOwnProperty('extraInformation.conns')) { + // always store the number of connections per instance so we can show correct in the UI + if (diff?.hasOwnProperty('extraInformation.conns')) { this.connsPerInstance.set(id, diff['extraInformation.conns']); this.validateAvailability(); @@ -73,7 +73,7 @@ export class Presence extends ServiceClass implements IPresence { clearTimeout(this.lostConTimeout); } - toggleBroadcast(enabled: boolean): void { + async toggleBroadcast(enabled: boolean): Promise { if (!this.hasLicense && this.getTotalConnections() > MAX_CONNECTIONS) { throw new Error('Cannot enable broadcast when there are more than 200 connections'); } @@ -81,7 +81,7 @@ export class Presence extends ServiceClass implements IPresence { // update the setting only to turn it on, because it may have been disabled via the troubleshooting setting, which doesn't affect the setting if (enabled) { - Settings.updateValueById('Presence_broadcast_disabled', false); + await Settings.updateValueById('Presence_broadcast_disabled', false); } } From 4dbf5d0e2af18062a9df1c54f772920640ac305c Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Mon, 13 Feb 2023 18:37:51 -0300 Subject: [PATCH 2/2] update setting description --- apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index 49912a13f696..c7cfb28fb78a 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -5508,7 +5508,7 @@ "Active_connections": "Active connections", "Presence_service": "Presence service", "Presence_broadcast_disabled": "Presence broadcast disabled internally", - "Presence_broadcast_disabled_Description": "Shows if the presence broadcast has been disabled internally. This will happen if you don't have an Enterprise License and has more than 200 concurrent connections.", + "Presence_broadcast_disabled_Description": "This shows if the presence broadcast has been disabled automatically. This can happen if you don't have an Enterprise License and have more than 200 concurrent connections.", "New_custom_status": "New custom status", "Service_disabled": "The service is now disabled", "Service_disabled_description": "You can't reenable it again until there's less than 200 active connections at the same time",