Fixes: Collection creation notification email

Added: Unsubscribe option to notification email footers
Added: Two new notification types (emails not written yet)
Fixed: Validation added to notification setting events
This commit is contained in:
Tom Moor
2018-12-05 23:44:41 -08:00
parent cc8dacba32
commit 9ca0038d39
8 changed files with 131 additions and 17 deletions

View File

@ -61,12 +61,21 @@ export default class Notifications {
document,
collection,
actor: document.updatedBy,
unsubscribeUrl: setting.unsubscribeUrl,
});
});
}
async collectionCreated(event: Event) {
const collection = await Collection.findById(event.model.id);
const collection = await Collection.findById(event.model.id, {
include: [
{
model: User,
required: true,
as: 'user',
},
],
});
if (!collection) return;
const notificationSettings = await NotificationSetting.findAll({
@ -92,7 +101,8 @@ export default class Notifications {
to: setting.user.email,
eventName: 'created',
collection,
actor: collection.createdBy,
actor: collection.user,
unsubscribeUrl: setting.unsubscribeUrl,
})
);
}