yusuketk hace 7 años
padre
commit
a49b855a3c
Se han modificado 2 ficheros con 2 adiciones y 2 borrados
  1. 1 1
      src/server/models/page-tag-relation.js
  2. 1 1
      src/server/models/page.js

+ 1 - 1
src/server/models/page-tag-relation.js

@@ -33,7 +33,7 @@ class PageTagRelation {
 
   static async createIfNotExist(pageId, tagId) {
     if (!await this.findOne({ relatedPage: pageId, relatedTag: tagId })) {
-      this.create({ relatedPage: pageId, relatedTag: tagId });
+      await this.create({ relatedPage: pageId, relatedTag: tagId });
     }
   }
 

+ 1 - 1
src/server/models/page.js

@@ -329,7 +329,7 @@ module.exports = function(crowi) {
     /* eslint-disable no-await-in-loop */
     for (const tag of newTags) {
       const setTag = await Tag.findOrCreate(tag);
-      PageTagRelation.createIfNotExist(page._id, setTag._id);
+      await PageTagRelation.createIfNotExist(page._id, setTag._id);
     }
   };