fix: Presence broadcast isn't enabled after license validation (#30282)

Co-authored-by: Diego Sampaio <chinello@gmail.com>
pull/30400/head
Matheus Barbosa Silva 2 years ago committed by Diego Sampaio
parent f46c1f7b70
commit d9a150000d
No known key found for this signature in database
GPG Key ID: B71D302EB7F5183C
  1. 5
      .changeset/tall-pumpkins-cross.md
  2. 11
      ee/packages/presence/src/Presence.ts

@ -0,0 +1,5 @@
---
"@rocket.chat/presence": patch
---
Fixed presence broadcast being disabled on server restart

@ -39,9 +39,14 @@ export class Presence extends ServiceClass implements IPresence {
}
});
this.onEvent('license.module', ({ module, valid }) => {
this.onEvent('license.module', async ({ module, valid }) => {
if (module === 'scalability') {
this.hasLicense = valid;
// broadcast should always be enabled if license is active (unless the troubleshoot setting is on)
if (!this.broadcastEnabled && valid) {
await this.toggleBroadcast(true);
}
}
});
}
@ -58,9 +63,9 @@ export class Presence extends ServiceClass implements IPresence {
}, 10000);
try {
this.hasLicense = await License.hasLicense('scalability');
await Settings.updateValueById('Presence_broadcast_disabled', false);
this.hasLicense = await License.hasLicense('scalability');
} catch (e: unknown) {
// ignore
}

Loading…
Cancel
Save