Skip to content

Commit

Permalink
[bug] Move "enable" flag to every rule; For bug 70325
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Oct 7, 2024
1 parent 43d30b2 commit 7396821
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
11 changes: 7 additions & 4 deletions Common/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
}
},
"notification": {
"enable": false,
"rules": {
"licenseExpirationWarning": {
"enable": true,
"transportType": [
"email"
],
Expand All @@ -50,6 +50,7 @@
}
},
"licenseExpirationError": {
"enable": false,
"transportType": [
"email"
],
Expand All @@ -62,6 +63,7 @@
}
},
"licenseLimitEdit": {
"enable": true,
"transportType": [
"email"
],
Expand All @@ -74,6 +76,7 @@
}
},
"licenseLimitLiveViewer": {
"enable": true,
"transportType": [
"email"
],
Expand Down Expand Up @@ -347,11 +350,11 @@
"forcesave": 604800,
"forcesaveLock": 5000,
"saved": 3600,
"documentsCron": "0 */2 * * * *",
"documentsCron": "*/10 * * * * *",
"files": 86400,
"filesCron": "00 00 */1 * * *",
"filesremovedatonce": 100,
"sessionidle": "1h",
"sessionidle": "10s",
"sessionabsolute": "30d",
"sessionclosecommand": "2m",
"pemStdTTL": "1h",
Expand Down Expand Up @@ -452,7 +455,7 @@
"license" : {
"license_file": "",
"warning_limit_percents": 70,
"packageType": 0,
"packageType": 1,
"warning_license_expiration": "30d"
},
"FileConverter": {
Expand Down
10 changes: 2 additions & 8 deletions Common/sources/notificationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const mailService = require('./mailService');

const cfgMailServer = config.get('email.smtpServerConfiguration');
const cfgMailMessageDefaults = config.get('email.contactDefaults');
const cfgNotificationEnable = config.get('notification.enable');
const cfgEditorDataStorage = config.get('services.CoAuthoring.server.editorDataStorage');
const cfgEditorStatStorage = config.get('services.CoAuthoring.server.editorStatStorage');
const editorStatStorage = require('./../../DocService/sources/' + (cfgEditorStatStorage || cfgEditorDataStorage));
Expand Down Expand Up @@ -108,14 +107,9 @@ class Transport {
}

async function notify(ctx, notificationType, message, opt_cacheKey = undefined) {
const tenNotificationEnable = ctx.getCfg('notification.enable', cfgNotificationEnable);
if (!tenNotificationEnable) {
return;
}
ctx.logger.debug('Notification service: notify "%s"', notificationType);

const tenRule = ctx.getCfg(`notification.rules.${notificationType}`, config.get(`notification.rules.${notificationType}`));
if (tenRule) {
if (tenRule?.enable) {
ctx.logger.debug('Notification service: notify "%s"', notificationType);
let checkRes = await checkRulePolicies(ctx, notificationType, tenRule, opt_cacheKey);
if (checkRes) {
await notifyRule(ctx, tenRule, message);
Expand Down

0 comments on commit 7396821

Please sign in to comment.