mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +00:00
Fix QA issues
This commit is contained in:
parent
b7f794a3f4
commit
498dc2fcbb
@ -132,7 +132,7 @@ const createAuditLogsService = (strapi) => {
|
||||
async register() {
|
||||
// Handle license being enabled
|
||||
if (!state.eeEnableUnsubscribe) {
|
||||
state.eeEnableUnsubscribe = strapi.eventHub.once('ee.enable', () => {
|
||||
state.eeEnableUnsubscribe = strapi.eventHub.on('ee.enable', () => {
|
||||
// Recreate the service to use the new license info
|
||||
this.destroy();
|
||||
this.register();
|
||||
@ -141,7 +141,7 @@ const createAuditLogsService = (strapi) => {
|
||||
|
||||
// Handle license being updated
|
||||
if (!state.eeUpdateUnsubscribe) {
|
||||
state.eeUpdateUnsubscribe = strapi.eventHub.once('ee.update', () => {
|
||||
state.eeUpdateUnsubscribe = strapi.eventHub.on('ee.update', () => {
|
||||
// Recreate the service to use the new license info
|
||||
this.destroy();
|
||||
this.register();
|
||||
@ -149,11 +149,16 @@ const createAuditLogsService = (strapi) => {
|
||||
}
|
||||
|
||||
// Handle license being disabled
|
||||
state.eeDisableUnsubscribe = strapi.eventHub.on('ee.disable', () => {
|
||||
// Turn off service when the license gets disabled
|
||||
// Only ee.enable and ee.update listeners remain active to recreate the service
|
||||
this.destroy();
|
||||
});
|
||||
if (!state.eeDisableUnsubscribe) {
|
||||
state.eeDisableUnsubscribe = strapi.eventHub.on('ee.disable', () => {
|
||||
// Turn off service when the license gets disabled
|
||||
// ee.enable and ee.update listeners remain active to recreate the service
|
||||
this.destroy();
|
||||
});
|
||||
}
|
||||
|
||||
// Register the provider now because collections can't be added later at runtime
|
||||
state.provider = await localProvider.register({ strapi });
|
||||
|
||||
// Check current state of license
|
||||
if (!features.isEnabled('audit-logs')) {
|
||||
@ -161,7 +166,6 @@ const createAuditLogsService = (strapi) => {
|
||||
}
|
||||
|
||||
// Start saving events
|
||||
state.provider = await localProvider.register({ strapi });
|
||||
state.eventHubUnsubscribe = strapi.eventHub.subscribe(handleEvent.bind(this));
|
||||
|
||||
// Manage audit logs auto deletion
|
||||
|
||||
@ -112,18 +112,18 @@ const onlineUpdate = async ({ strapi }) => {
|
||||
try {
|
||||
// Verify license and check if its info changed
|
||||
const newLicenseInfo = verifyLicense(license);
|
||||
const fieldsToCompare = ['licenseKey', 'features', 'plan'];
|
||||
const licenseInfoChanged = !isEqual(
|
||||
pick(fieldsToCompare, newLicenseInfo),
|
||||
pick(fieldsToCompare, ee.licenseInfo)
|
||||
);
|
||||
const licenseInfoChanged =
|
||||
!isEqual(newLicenseInfo.features, ee.licenseInfo.features) ||
|
||||
newLicenseInfo.seats !== ee.licenseInfo.seats ||
|
||||
newLicenseInfo.type !== ee.licenseInfo.type;
|
||||
|
||||
// Store the new license info
|
||||
ee.licenseInfo = newLicenseInfo;
|
||||
const wasEnabled = ee.enabled;
|
||||
validateInfo();
|
||||
|
||||
// Notify EE features
|
||||
if (licenseInfoChanged) {
|
||||
if (licenseInfoChanged && wasEnabled) {
|
||||
strapi.eventHub.emit('ee.update');
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user