Sfoglia il codice sorgente

Merge pull request #3534 from weseek/imprv/gw5412-gw5283-FB

Imprv/gw5412 gw5283 fb
Kaori Tokashiki 5 anni fa
parent
commit
d77a71a8f7
1 ha cambiato i file con 11 aggiunte e 7 eliminazioni
  1. 11 7
      src/server/service/bolt.js

+ 11 - 7
src/server/service/bolt.js

@@ -153,6 +153,12 @@ class BoltService {
     return;
     return;
   }
   }
 
 
+  getKeywords(args) {
+    const keywordsArr = args.slice(1);
+    const keywords = keywordsArr.join(' ');
+    return keywords;
+  }
+
   async getSearchResultPaths(command, args, offset = 0) {
   async getSearchResultPaths(command, args, offset = 0) {
     const firstKeyword = args[1];
     const firstKeyword = args[1];
     if (firstKeyword == null) {
     if (firstKeyword == null) {
@@ -166,11 +172,7 @@ class BoltService {
       return;
       return;
     }
     }
 
 
-    const keywordsArr = [];
-    for (let i = 1; i < args.length; i++) {
-      keywordsArr.push(args[i]);
-    }
-    const keywords = keywordsArr.join(' ');
+    const keywords = this.getKeywords(args);
 
 
     const { searchService } = this.crowi;
     const { searchService } = this.crowi;
     const options = { limit: 10, offset };
     const options = { limit: 10, offset };
@@ -210,15 +212,17 @@ class BoltService {
     });
     });
 
 
     return {
     return {
-      resultPaths, offset, keywords, resultsTotal,
+      resultPaths, offset, resultsTotal,
     };
     };
   }
   }
 
 
   async showEphemeralSearchResults(command, args, offsetNum) {
   async showEphemeralSearchResults(command, args, offsetNum) {
     const {
     const {
-      resultPaths, offset, keywords, resultsTotal,
+      resultPaths, offset, resultsTotal,
     } = await this.getSearchResultPaths(command, args, offsetNum);
     } = await this.getSearchResultPaths(command, args, offsetNum);
 
 
+    const keywords = this.getKeywords(args);
+
     if (resultPaths == null) {
     if (resultPaths == null) {
       return;
       return;
     }
     }