notifications: fix update notification

the notification wasn't working because this was in apptask and the apptask died
before it could send out the email. we now move the notification to box process
and also remove the email notification.
This commit is contained in:
Girish Ramakrishnan
2021-04-19 14:22:22 -07:00
parent 3ab0a25ec9
commit 355de5b0a4
8 changed files with 60 additions and 169 deletions

View File

@@ -44,8 +44,6 @@ function add(userId, eventId, title, message, callback) {
assert.strictEqual(typeof message, 'string');
assert.strictEqual(typeof callback, 'function');
debug('add: ', userId, title);
notificationdb.add({
userId: userId,
eventId: eventId,
@@ -203,14 +201,7 @@ function appUpdated(eventId, app, callback) {
: `${app.manifest.title} at ${app.fqdn} updated to package version ${app.manifest.version}`;
forEachAdmin({ skip: [] }, function (admin, done) {
add(admin.id, eventId, title, `The application installed at https://${app.fqdn} was updated.\n\nChangelog:\n${app.manifest.changelog}\n`, function (error) {
if (error) return callback(error);
mailer.appUpdated(admin.email, app, function (error) {
if (error) debug('appUpdated: Failed to send app updated email', error); // non fatal
done();
});
});
add(admin.id, eventId, title, `The application installed at https://${app.fqdn} was updated.\n\nChangelog:\n${app.manifest.changelog}\n`, done);
}, callback);
}
@@ -303,7 +294,6 @@ function alert(id, title, message, callback) {
assert.strictEqual(typeof callback, 'function');
const acknowledged = !message;
debug(`alert: id=${id} title=${title} ack=${acknowledged}`);
forEachAdmin({ skip: [] }, function (admin, callback) {
const data = {