takeru0001 5 سال پیش
والد
کامیت
1f72612f3a
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      src/server/service/search-delegator/elasticsearch.js

+ 4 - 4
src/server/service/search-delegator/elasticsearch.js

@@ -961,14 +961,14 @@ class ElasticsearchDelegator {
   async syncDescendantsPagesUpdated(page, user) {
   async syncDescendantsPagesUpdated(page, user) {
 
 
     const Page = mongoose.model('Page');
     const Page = mongoose.model('Page');
-    const pages = Page.findManageableListWithDescendants(page, user);
+    const pages = await Page.findManageableListWithDescendants(page, user);
 
 
-    const deletePages = pages.map((page) => {
+    const shoudDeletePages = [];
+    pages.forEach((page) => {
       logger.debug('SearchClient.syncPageUpdated', page.path);
       logger.debug('SearchClient.syncPageUpdated', page.path);
       if (!this.shouldIndexed(page)) {
       if (!this.shouldIndexed(page)) {
-        return page;
+        shoudDeletePages.append(page);
       }
       }
-      return;
     });
     });
 
 
     // delete if page should not indexed
     // delete if page should not indexed