feat: tags autocomplete in page properties

This commit is contained in:
NGPixel
2020-02-02 16:24:27 -05:00
parent a1e0e4f27a
commit f4e3fd0954
5 changed files with 80 additions and 7 deletions

View File

@@ -53,6 +53,10 @@ module.exports = class Tag extends Model {
static async associateTags ({ tags, page }) {
let existingTags = await WIKI.models.tags.query().column('id', 'tag')
// Format tags
tags = _.uniq(tags.map(t => t.toLowerCase()))
// Create missing tags
const newTags = _.filter(tags, t => !_.some(existingTags, ['tag', t])).map(t => ({