[bug] Move "enable" flag to every rule; For bug 70325

This commit is contained in:
Sergey Konovalov
2024-10-07 10:30:15 +03:00
parent 470233f3eb
commit 2c3a04f106
2 changed files with 9 additions and 12 deletions

View File

@ -35,9 +35,9 @@
}
},
"notification": {
"enable": false,
"rules": {
"licenseExpirationWarning": {
"enable": true,
"transportType": [
"email"
],
@ -50,6 +50,7 @@
}
},
"licenseExpirationError": {
"enable": false,
"transportType": [
"email"
],
@ -62,6 +63,7 @@
}
},
"licenseLimitEdit": {
"enable": true,
"transportType": [
"email"
],
@ -74,6 +76,7 @@
}
},
"licenseLimitLiveViewer": {
"enable": true,
"transportType": [
"email"
],
@ -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",
@ -452,7 +455,7 @@
"license" : {
"license_file": "",
"warning_limit_percents": 70,
"packageType": 0,
"packageType": 1,
"warning_license_expiration": "30d"
},
"FileConverter": {

View File

@ -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));
@ -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);