Skip to content

Commit

Permalink
Merge branch 'develop' into chore/contextualbarDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris authored Mar 18, 2024
2 parents 3746eea + b7fa3b2 commit c343dbf
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 18 deletions.
23 changes: 13 additions & 10 deletions apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ test.describe('OC - Manage Units', () => {

test.beforeEach(async ({ page }: { page: Page }) => {
poOmnichannelUnits = new OmnichannelUnits(page);

await page.goto('/omnichannel');
await poOmnichannelUnits.sidenav.linkUnits.click();
});

test('OC - Manage Units - Create Unit', async ({ page }) => {
const unitName = faker.string.uuid();

await page.goto('/omnichannel');
await poOmnichannelUnits.sidenav.linkUnits.click();

await test.step('expect correct form default state', async () => {
await poOmnichannelUnits.btnCreateUnit.click();
await expect(poOmnichannelUnits.contextualBar).toBeVisible();
Expand Down Expand Up @@ -104,7 +104,10 @@ test.describe('OC - Manage Units', () => {
});

test('OC - Manage Units - Edit unit', async ({ api, page }) => {
const edittedUnitName = faker.string.uuid();
const editedUnitName = faker.string.uuid();

await page.goto('/omnichannel');
await poOmnichannelUnits.sidenav.linkUnits.click();

const unit = await test.step('expect to create new unit', async () => {
const { data: unit } = await createOrUpdateUnit(api, {
Expand All @@ -121,19 +124,19 @@ test.describe('OC - Manage Units', () => {
await poOmnichannelUnits.search(unit.name);
await poOmnichannelUnits.findRowByName(unit.name).click();
await expect(poOmnichannelUnits.contextualBar).toBeVisible();
await poOmnichannelUnits.inputName.fill(edittedUnitName);
await poOmnichannelUnits.inputName.fill(editedUnitName);
await poOmnichannelUnits.btnSave.click();
});

await test.step('expect unit to have been edited', async () => {
await poOmnichannelUnits.sidenav.linkPriorities.click();
await poOmnichannelUnits.sidenav.linkUnits.click(); // refresh the page
await poOmnichannelUnits.search(edittedUnitName);
await expect(poOmnichannelUnits.findRowByName(edittedUnitName)).toBeVisible();
await poOmnichannelUnits.search(editedUnitName);
await expect(poOmnichannelUnits.findRowByName(editedUnitName)).toBeVisible();
});

await test.step('expect to delete unit', async () => {
await poOmnichannelUnits.findRowByName(edittedUnitName).click();
await poOmnichannelUnits.findRowByName(editedUnitName).click();
await expect(poOmnichannelUnits.contextualBar).toBeVisible();

await test.step('expect confirm delete unit', async () => {
Expand All @@ -159,8 +162,8 @@ test.describe('OC - Manage Units', () => {
await poOmnichannelUnits.sidenav.linkUnits.click(); // refresh the page

if (await poOmnichannelUnits.inputSearch.isVisible()) {
await poOmnichannelUnits.search(edittedUnitName);
await expect(poOmnichannelUnits.findRowByName(edittedUnitName)).not.toBeVisible();
await poOmnichannelUnits.search(editedUnitName);
await expect(poOmnichannelUnits.findRowByName(editedUnitName)).not.toBeVisible();
} else {
await expect(page.locator('h3 >> text="No units yet"')).toBeVisible();
}
Expand Down
1 change: 1 addition & 0 deletions ee/packages/license/src/v2/bundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const bundles: IBundle = {
'hide-watermark',
'custom-roles',
'accessibility-certification',
'unlimited-presence',
],
pro: [],
};
Expand Down
29 changes: 22 additions & 7 deletions ee/packages/presence/src/Presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export class Presence extends ServiceClass implements IPresence {

private broadcastEnabled = true;

private hasPresenceLicense = false;

private hasScalabilityLicense = false;

private hasLicense = false;

private lostConTimeout?: NodeJS.Timeout;
Expand Down Expand Up @@ -43,13 +47,22 @@ export class Presence extends ServiceClass implements IPresence {
});

this.onEvent('license.module', async ({ module, valid }) => {
if (module === 'scalability') {
this.hasLicense = valid;
switch (module) {
case 'unlimited-presence':
this.hasPresenceLicense = valid;
break;
case 'scalability':
this.hasScalabilityLicense = valid;
break;
default:
return;
}

// broadcast should always be enabled if license is active (unless the troubleshoot setting is on)
if (!this.broadcastEnabled && valid) {
await this.toggleBroadcast(true);
}
// The scalability module is also accepted as a way to enable the presence service for backwards compatibility
this.hasLicense = this.hasPresenceLicense || this.hasScalabilityLicense;
// broadcast should always be enabled if license is active (unless the troubleshoot setting is on)
if (!this.broadcastEnabled && this.hasLicense) {
await this.toggleBroadcast(true);
}
});
}
Expand All @@ -68,7 +81,9 @@ export class Presence extends ServiceClass implements IPresence {
try {
await Settings.updateValueById('Presence_broadcast_disabled', false);

this.hasLicense = await License.hasModule('scalability');
this.hasScalabilityLicense = await License.hasModule('scalability');
this.hasPresenceLicense = await License.hasModule('unlimited-presence');
this.hasLicense = this.hasPresenceLicense || this.hasScalabilityLicense;
} catch (e: unknown) {
// ignore
}
Expand Down
3 changes: 2 additions & 1 deletion packages/core-typings/src/license/LicenseModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export type LicenseModule =
| 'outlook-calendar'
| 'hide-watermark'
| 'custom-roles'
| 'accessibility-certification';
| 'accessibility-certification'
| 'unlimited-presence';
1 change: 1 addition & 0 deletions packages/jwt/__tests__/jwt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ it('should sign and verify a jwt with RS256', async () => {
{ module: 'videoconference-enterprise' },
{ module: 'message-read-receipt' },
{ module: 'outlook-calendar' },
{ module: 'unlimited-presence' },
],
limits: {
activeUsers: [
Expand Down

0 comments on commit c343dbf

Please sign in to comment.