Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Fix presence broadcast not re-enabling #28017

Merged
merged 6 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/meteor/app/lib/server/startup/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3271,7 +3271,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, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ function BooleanSettingInput({
id={_id}
value='true'
checked={value === true}
disabled={disabled}
readOnly={readonly}
disabled={disabled || readonly}
onChange={handleChange}
/>
<Field.Label htmlFor={_id} title={_id}>
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5583,7 +5583,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",
Expand Down
8 changes: 4 additions & 4 deletions ee/packages/presence/src/Presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -73,15 +73,15 @@ export class Presence extends ServiceClass implements IPresence {
clearTimeout(this.lostConTimeout);
}

toggleBroadcast(enabled: boolean): void {
async toggleBroadcast(enabled: boolean): Promise<void> {
if (!this.hasLicense && this.getTotalConnections() > MAX_CONNECTIONS) {
throw new Error('Cannot enable broadcast when there are more than 200 connections');
}
this.broadcastEnabled = enabled;

// 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);
}
}

Expand Down