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 1 commit
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 @@ -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, {
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
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