confirm each tag in auth event

This commit is contained in:
les 2021-03-19 00:35:54 +01:00
parent 6f35e2e1e2
commit dd98d2adc6
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -307,7 +307,7 @@ const eventController = {
if (body.tags) {
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 Promise.all(tags.map(t => t.update({ weigth: Number(t.weigth) + 1, confirmed: true })))
await event.addTags(tags)
event.tags = tags
}