Przeglądaj źródła

GW-6560 Added -- to time expressions

hakumizuki 4 lat temu
rodzic
commit
f0090614b7
2 zmienionych plików z 9 dodań i 3 usunięć
  1. 2 2
      config/env.dev.js
  2. 7 1
      src/server/service/slackbot.js

+ 2 - 2
config/env.dev.js

@@ -22,8 +22,8 @@ module.exports = {
   // DEV_HTTPS: true,
   // DEV_HTTPS: true,
   // FORCE_WIKI_MODE: 'private', // 'public', 'private', undefined
   // FORCE_WIKI_MODE: 'private', // 'public', 'private', undefined
   // PROMSTER_ENABLED: true,
   // PROMSTER_ENABLED: true,
-  // SLACK_SIGNING_SECRET: '',
-  // SLACK_BOT_TOKEN: '',
+  SLACK_SIGNING_SECRET: '700c6a09e385577d35943c2a9ecc35d2',
+  SLACK_BOT_TOKEN: 'xoxb-2216907132596-2201060929479-nSm6I0fdiB4JuRLFzyzPyWKb',
   SALT_FOR_GTOP_TOKEN: 'proxy',
   SALT_FOR_GTOP_TOKEN: 'proxy',
   SALT_FOR_PTOG_TOKEN: 'growi',
   SALT_FOR_PTOG_TOKEN: 'growi',
   // GROWI_CLOUD_URI: 'http://growi.cloud',
   // GROWI_CLOUD_URI: 'http://growi.cloud',

+ 7 - 1
src/server/service/slackbot.js

@@ -391,6 +391,7 @@ class SlackBotService extends S2sMessageHandlable {
     const reshape = (str) => {
     const reshape = (str) => {
       const regexpSectionHeader = new RegExp(/.+\s\s[\d]{1,2}:[\d]{2}(\s[AP]{1}M)?$/);
       const regexpSectionHeader = new RegExp(/.+\s\s[\d]{1,2}:[\d]{2}(\s[AP]{1}M)?$/);
       const regexpTime = new RegExp(/\s\s[\d]{1,2}:[\d]{2}(\s[AP]{1}M)?$/);
       const regexpTime = new RegExp(/\s\s[\d]{1,2}:[\d]{2}(\s[AP]{1}M)?$/);
+      const regexpShortTime = new RegExp(/^[\d]{1,2}:[\d]{2}$/);
       const regexpReaction = new RegExp(/^:[+\w-]+:$/);
       const regexpReaction = new RegExp(/^:[+\w-]+:$/);
 
 
       const splitted = str.split('\n');
       const splitted = str.split('\n');
@@ -416,7 +417,12 @@ class SlackBotService extends S2sMessageHandlable {
           copyline = '</div>\n<div class="slack-talk-bubble">\n\n## **'.concat(copyline);
           copyline = '</div>\n<div class="slack-talk-bubble">\n\n## **'.concat(copyline);
           copyline = copyline.replace(regexpTime, '**'.concat(time), '\n<');
           copyline = copyline.replace(regexpTime, '**'.concat(time), '\n<');
         }
         }
-        // Check 3: Is this line a reaction?
+        // Check 3: Is this line a short time(HH:mm)?
+        else if (regexpShortTime.test(copyline)) {
+          // --HH:mm--
+          copyline = '--'.concat(copyline, '--');
+        }
+        // Check 4: Is this line a reaction?
         else if (regexpReaction.test(copyline)) {
         else if (regexpReaction.test(copyline)) {
           // remove reaction
           // remove reaction
           copyline = '';
           copyline = '';