This commit is contained in:
lesion
2019-06-07 17:02:33 +02:00
parent 7455553129
commit c408c44676
40 changed files with 270 additions and 279 deletions

View File

@@ -7,13 +7,13 @@ const { Event, Notification, EventNotification,
User, Place, Tag } = require('./api/models')
let settings
async function sendNotification (notification, event, eventNotification) {
async function sendNotification(notification, event, eventNotification) {
const promises = []
switch (notification.type) {
// case 'mail':
// return mail.send(notification.email, 'event', { event, config, notification })
// return mail.send(notification.email, 'event', { event, config, notification })
// case 'admin_email':
// const admins = await User.findAll({ where: { is_admin: true } })
// const admins = await User.findAll({ where: { is_admin: true } })
// const admin_emails = admins.map(admin => admin.email)
// return mail.send(admin_emails, 'event', { event, to_confirm: true, notification })
case 'mastodon':
@@ -56,11 +56,11 @@ async function notify() {
let interval
function startLoop(seconds) {
console.error('starting notifier loop')
interval = setInterval(notify, seconds*1000)
interval = setInterval(notify, seconds * 1000)
}
function stopLoop() {
stopInterval(interval)
}
module.exports = { startLoop, stopLoop }
module.exports = { startLoop, stopLoop }