mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[bug] Change license notification message; For bug 70325
This commit is contained in:
@ -42,8 +42,9 @@
|
||||
"email"
|
||||
],
|
||||
"template": {
|
||||
"title": "License expiration",
|
||||
"body": "%s license %s on %s!!!"
|
||||
"title": "License expiration warning",
|
||||
"bodyWarn": "Attention! Your license is about to expire on %s.\nUpon reaching this date, you will no longer be entitled to receive personal technical support and install new Docs versions released after this date.",
|
||||
"bodyError": "Attention! Your license expired on %s.\nYou are no longer entitled to receive personal technical support and install new Docs versions released after this date.\nPlease contact sales@onlyoffice.com to discuss license renewal."
|
||||
},
|
||||
"policies": {
|
||||
"repeatInterval": "1d"
|
||||
@ -54,8 +55,8 @@
|
||||
"email"
|
||||
],
|
||||
"template": {
|
||||
"title": "License limit",
|
||||
"body": "%s limit exceeded!!!"
|
||||
"title": "License connection limit warning",
|
||||
"body": "Attention! You have reached %s%% of the %s limit set by your license."
|
||||
},
|
||||
"policies": {
|
||||
"repeatInterval": "1h"
|
||||
|
||||
@ -52,7 +52,7 @@ const notificationTypes = {
|
||||
|
||||
class TransportInterface {
|
||||
async send(ctx, message) {}
|
||||
contentGeneration(template, messageParams) {}
|
||||
contentGeneration(template, message) {}
|
||||
}
|
||||
|
||||
class MailTransport extends TransportInterface {
|
||||
@ -71,10 +71,10 @@ class MailTransport extends TransportInterface {
|
||||
return mailService.send(this.host, this.auth.user, message);
|
||||
}
|
||||
|
||||
contentGeneration(template, messageParams) {
|
||||
contentGeneration(template, message) {
|
||||
return {
|
||||
subject: template.title,
|
||||
text: util.format(template.body, ...messageParams)
|
||||
text: message
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ class Transport {
|
||||
}
|
||||
}
|
||||
|
||||
async function notify(ctx, notificationType, messageParams) {
|
||||
async function notify(ctx, notificationType, message) {
|
||||
const tenNotificationEnable = ctx.getCfg('notification.enable', cfgNotificationEnable);
|
||||
if (!tenNotificationEnable) {
|
||||
return;
|
||||
@ -116,7 +116,7 @@ async function notify(ctx, notificationType, messageParams) {
|
||||
if (tenRule) {
|
||||
let checkRes = await checkRulePolicies(ctx, notificationType, tenRule);
|
||||
if (checkRes) {
|
||||
await notifyRule(ctx, tenRule, messageParams);
|
||||
await notifyRule(ctx, tenRule, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -136,12 +136,12 @@ async function checkRulePolicies(ctx, notificationType, tenRule) {
|
||||
return isLock;
|
||||
}
|
||||
|
||||
async function notifyRule(ctx, tenRule, messageParams) {
|
||||
async function notifyRule(ctx, tenRule, message) {
|
||||
const transportObjects = tenRule.transportType.map(transport => new Transport(ctx, transport));
|
||||
for (const transportObject of transportObjects) {
|
||||
try {
|
||||
const message = transportObject.transport.contentGeneration(tenRule.template, messageParams);
|
||||
await transportObject.transport.send(ctx, message);
|
||||
const mail = transportObject.transport.contentGeneration(tenRule.template, message);
|
||||
await transportObject.transport.send(ctx, mail);
|
||||
} catch (error) {
|
||||
ctx.logger.error('Notification service: error: %s', error.stack);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user