Skip to content

Commit

Permalink
fix: Presence broadcast isn't enabled after license validation (#30282)
Browse files Browse the repository at this point in the history
Co-authored-by: Diego Sampaio <chinello@gmail.com>
  • Loading branch information
matheusbsilva137 and sampaiodiego authored Sep 18, 2023
1 parent b3fa016 commit 9a90bff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tall-pumpkins-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/presence": patch
---

Fixed presence broadcast being disabled on server restart
11 changes: 8 additions & 3 deletions ee/packages/presence/src/Presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
});
}
Expand All @@ -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
}
Expand Down

0 comments on commit 9a90bff

Please sign in to comment.