various notification fixes
This commit is contained in:
@@ -63,6 +63,8 @@ async function add(type, title, message, data) {
|
||||
assert.strictEqual(typeof message, 'string');
|
||||
assert.strictEqual(typeof data, 'object');
|
||||
|
||||
debug(`add: ${type} ${title}`);
|
||||
|
||||
const query = 'INSERT INTO notifications (type, title, message, acknowledged, eventId, context) VALUES (?, ?, ?, ?, ?, ?)';
|
||||
const args = [ type, title, message, false, data?.eventId || null, data.context || '' ];
|
||||
|
||||
@@ -137,7 +139,7 @@ async function list(filters, page, perPage) {
|
||||
return results;
|
||||
}
|
||||
|
||||
async function oomEvent(eventId, containerId, app, addonName /*, event*/) {
|
||||
async function oomEvent(eventId, containerId, app, addonName, event) {
|
||||
assert.strictEqual(typeof eventId, 'string');
|
||||
assert.strictEqual(typeof containerId, 'string');
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
@@ -164,7 +166,7 @@ async function oomEvent(eventId, containerId, app, addonName /*, event*/) {
|
||||
const admins = await users.getAdmins();
|
||||
for (const admin of admins) {
|
||||
if (admin.notificationConfig.includes(exports.TYPE_APP_OOM)) {
|
||||
await mailer.oomEvent(admin.email, app, addonName);
|
||||
await mailer.oomEvent(admin.email, containerId, app, addonName, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,7 +178,7 @@ async function appUp(eventId, app) {
|
||||
const admins = await users.getAdmins();
|
||||
for (const admin of admins) {
|
||||
if (admin.notificationConfig.includes(exports.TYPE_APP_UP)) {
|
||||
await mailer.appDown(admin.email, app);
|
||||
await mailer.appUp(admin.email, app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user