zahmis пре 5 година
родитељ
комит
1f347c207c
1 измењених фајлова са 5 додато и 3 уклоњено
  1. 5 3
      src/server/service/bolt.js

+ 5 - 3
src/server/service/bolt.js

@@ -91,12 +91,14 @@ class BoltService {
       const firstArg = inputSlack[0];
       const firstArg = inputSlack[0];
       const secondArg = inputSlack[1];
       const secondArg = inputSlack[1];
 
 
-      let searchResultsData;
+      let paths;
       if (firstArg === 'search') {
       if (firstArg === 'search') {
         const { searchService } = this.crowi;
         const { searchService } = this.crowi;
         const option = { limit: 10 };
         const option = { limit: 10 };
         const searchResults = await searchService.searchKeyword(secondArg, null, {}, option);
         const searchResults = await searchService.searchKeyword(secondArg, null, {}, option);
-        searchResultsData = searchResults.data;
+        paths = searchResults.data.map((data) => {
+          return data._source.path;
+        });
       }
       }
 
 
       // TODO impl try-catch
       // TODO impl try-catch
@@ -108,7 +110,7 @@ class BoltService {
             type: 'section',
             type: 'section',
             text: {
             text: {
               type: 'mrkdwn',
               type: 'mrkdwn',
-              text: `${searchResultsData.map((data) => { return `\n${data._source.path}` })}`,
+              text: `${paths.join('\n')}`,
             },
             },
           }],
           }],
         });
         });