Răsfoiți Sursa

BugFix: populate lastUpdateUser in findListByPageIds

Yuki Takei 7 ani în urmă
părinte
comite
46a034e370
1 a modificat fișierele cu 4 adăugiri și 1 ștergeri
  1. 4 1
      src/server/models/page.js

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

@@ -625,6 +625,8 @@ module.exports = function(crowi) {
   };
 
   pageSchema.statics.findListByPageIds = async function(ids, option) {
+    const User = crowi.model('User');
+
     const opt = Object.assign({}, option);
     const builder = new PageQueryBuilder(this.find({ _id: { $in: ids } }));
 
@@ -632,7 +634,8 @@ module.exports = function(crowi) {
     builder.addConditionToPagenate(opt.offset, opt.limit);
 
     const totalCount = await builder.query.exec('count');
-    const q = builder.query;
+    const q = builder.query
+      .populate({ path: 'lastUpdateUser', model: 'User', select: User.USER_PUBLIC_FIELDS });
     const pages = await q.exec('find');
 
     const result = { pages, totalCount, offset: opt.offset, limit: opt.limit };