mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
confirm tag/place only if auth
This commit is contained in:
parent
f73168ae9e
commit
f9f29154a2
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue