@@ -110,6 +110,9 @@ const userController = {
|
||||
async updateEvent (req, res) {
|
||||
const body = req.body
|
||||
const event = await Event.findByPk(body.id)
|
||||
if (!req.user.is_admin && event.userId !== req.user.id) {
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
|
||||
body.description = body.description
|
||||
.replace(/(<([^>]+)>)/ig, '') // remove all tags from description
|
||||
@@ -142,11 +145,6 @@ const userController = {
|
||||
return res.json(newEvent)
|
||||
},
|
||||
|
||||
async getMyEvents (req, res) {
|
||||
const events = await req.user.getEvents()
|
||||
res.json(events)
|
||||
},
|
||||
|
||||
async getAuthURL (req, res) {
|
||||
const instance = req.body.instance
|
||||
const { client_id, client_secret } = await Mastodon.createOAuthApp(`https://${instance}/api/v1/apps`, 'eventi', 'read write', `${config.baseurl}/settings`)
|
||||
|
||||
Reference in New Issue
Block a user