minor
This commit is contained in:
@@ -7,7 +7,6 @@ const settingsController = require('./settings')
|
|||||||
const eventController = require('./event')
|
const eventController = require('./event')
|
||||||
const config = require('../config')
|
const config = require('../config')
|
||||||
const mail = require('../mail')
|
const mail = require('../mail')
|
||||||
const bot = require('./bot')
|
|
||||||
const { Op } = require('sequelize')
|
const { Op } = require('sequelize')
|
||||||
|
|
||||||
const userController = {
|
const userController = {
|
||||||
@@ -44,8 +43,8 @@ const userController = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async delEvent (req, res) {
|
async delEvent (req, res) {
|
||||||
// check if event is mine
|
|
||||||
const event = await Event.findByPk(req.params.id)
|
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)) {
|
if (event && (req.user.is_admin || req.user.id === event.userId)) {
|
||||||
await event.destroy()
|
await event.destroy()
|
||||||
res.sendStatus(200)
|
res.sendStatus(200)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ async function sendNotification (notification, event, eventNotification) {
|
|||||||
break
|
break
|
||||||
case 'mastodon':
|
case 'mastodon':
|
||||||
// instance publish
|
// 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)
|
const b = bot.post(settings.mastodon_auth, event)
|
||||||
promises.push(b)
|
promises.push(b)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user