This commit is contained in:
lesion 2019-03-14 11:12:56 +01:00
parent c9c7db2f46
commit df2e1e0363
2 changed files with 2 additions and 3 deletions

View file

@ -7,7 +7,6 @@ const settingsController = require('./settings')
const eventController = require('./event')
const config = require('../config')
const mail = require('../mail')
const bot = require('./bot')
const { Op } = require('sequelize')
const userController = {
@ -44,8 +43,8 @@ const userController = {
},
async delEvent (req, res) {
// check if event is mine
const event = await Event.findByPk(req.params.id)
// check if event is mine (or user is admin)
if (event && (req.user.is_admin || req.user.id === event.userId)) {
await event.destroy()
res.sendStatus(200)

View file

@ -21,7 +21,7 @@ async function sendNotification (notification, event, eventNotification) {
break
case 'mastodon':
// instance publish
if (settings.mastodon_auth.instance) {
if (settings.mastodon_auth.instance && settings.mastodon_auth.access_token) {
const b = bot.post(settings.mastodon_auth, event)
promises.push(b)
}