From f9f29154a2c428b3b6e893360ea63ed5771829b4 Mon Sep 17 00:00:00 2001 From: les Date: Mon, 31 Aug 2020 16:47:33 +0200 Subject: [PATCH] confirm tag/place only if auth --- server/api/controller/event.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/api/controller/event.js b/server/api/controller/event.js index ea96b2f8..9d739df4 100644 --- a/server/api/controller/event.js +++ b/server/api/controller/event.js @@ -277,7 +277,10 @@ const eventController = { const [place] = await Place.findOrCreate({ where: { name: body.place_name }, - defaults: { address: body.place_address } + defaults: { + address: body.place_address, + confirmed: !!req.user + } }) await event.setPlace(place) @@ -285,7 +288,7 @@ const eventController = { // create/assign tags if (body.tags) { - await Tag.bulkCreate(body.tags.map(t => ({ tag: t })), { ignoreDuplicates: true }) + await Tag.bulkCreate(body.tags.map(t => ({ tag: t, confirmed: !!req.user })), { ignoreDuplicates: true }) const tags = await Tag.findAll({ where: { tag: { [Op.in]: body.tags } } }) await Promise.all(tags.map(t => t.update({ weigth: Number(t.weigth) + 1 }))) await event.addTags(tags)