Skip to content

Commit

Permalink
Implemented disable_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc committed Sep 15, 2023
1 parent 82ddfef commit 4072803
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 80 deletions.
9 changes: 6 additions & 3 deletions apps/meteor/client/views/hooks/useUpgradeTabParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ export const useUpgradeTabParams = (): { tabType: UpgradeTabVariant | false; tri
const hasValidLicense = licensesData?.licenses.some((license) => license.modules.length > 0) ?? false;
const hadExpiredTrials = cloudWorkspaceHadTrial ?? false;

const trialLicense = licensesData?.licenses?.find(({ meta }) => meta?.trial);
const isTrial = licensesData?.licenses?.every(({ meta }) => meta?.trial) ?? false;
const trialEndDate = trialLicense?.meta ? format(new Date(trialLicense.meta.trialEnd), 'yyyy-MM-dd') : undefined;
// #TODO: Update to use license v3 format, load meta info from license.information
const licenseMeta = licensesData?.licenses?.map((license: any) => (license.meta ?? license.cloudMeta) as Record<string, any>);

const trialLicense = licenseMeta?.find((meta) => meta?.trial);
const isTrial = licenseMeta?.every((meta) => meta?.trial) ?? false;
const trialEndDate = trialLicense ? format(new Date(trialLicense.trialEnd), 'yyyy-MM-dd') : undefined;

const upgradeTabType = getUpgradeTabType({
registered,
Expand Down
5 changes: 3 additions & 2 deletions apps/meteor/ee/app/license/server/fromV2toV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Transform a License V2 into a V3 representation.
*/

import type { ILicenseV2, ILicenseV3, Module } from '@rocket.chat/core-typings';
import type { ILicenseV2, ILicenseV3, LicenseModule } from '@rocket.chat/core-typings';

import { isBundle, getBundleFromModule, getBundleModules } from './bundles';
import { getTagColor } from './getTagColor';
Expand Down Expand Up @@ -53,7 +53,7 @@ export const fromV2toV3 = (v2: ILicenseV2): ILicenseV3 => {
v2.modules
.map((licenseModule) => (isBundle(licenseModule) ? getBundleModules(licenseModule) : [licenseModule]))
.reduce((prev, curr) => [...prev, ...curr], [])
.map((licenseModule) => ({ module: licenseModule as Module })),
.map((licenseModule) => ({ module: licenseModule as LicenseModule })),
),
],
limits: {
Expand Down Expand Up @@ -108,5 +108,6 @@ export const fromV2toV3 = (v2: ILicenseV2): ILicenseV3 => {
}
: {}),
},
cloudMeta: v2.meta,
};
};
Loading

0 comments on commit 4072803

Please sign in to comment.