Просмотр исходного кода

Merge pull request #4321 from weseek/fix/7464-undefined-nan-fix

fix: Response when no pages are found /growi search
Yuki Takei 4 лет назад
Родитель
Сommit
29e3212908
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      packages/app/src/server/service/slack-command-handler/search.js

+ 5 - 1
packages/app/src/server/service/slack-command-handler/search.js

@@ -35,6 +35,10 @@ module.exports = (crowi) => {
       pages, offset, resultsTotal,
       pages, offset, resultsTotal,
     } = searchResult;
     } = searchResult;
 
 
+    if (pages.length === 0) {
+      return;
+    }
+
     const keywords = this.getKeywords(args);
     const keywords = this.getKeywords(args);
 
 
 
 
@@ -361,7 +365,7 @@ module.exports = (crowi) => {
         user: body.user_id,
         user: body.user_id,
         text: `No page found with "${keywords}"`,
         text: `No page found with "${keywords}"`,
         blocks: [
         blocks: [
-          markdownSectionBlock(`*No page that matches your keyword(s) "${keywords}".*`),
+          markdownSectionBlock(`*No page matches your keyword(s) "${keywords}".*`),
           markdownSectionBlock(':mag: *Help: Searching*'),
           markdownSectionBlock(':mag: *Help: Searching*'),
           divider(),
           divider(),
           markdownSectionBlock('`word1` `word2` (divide with space) \n Search pages that include both word1, word2 in the title or body'),
           markdownSectionBlock('`word1` `word2` (divide with space) \n Search pages that include both word1, word2 in the title or body'),