Explorar o código

remove the common function for the buttons

kaori %!s(int64=5) %!d(string=hai) anos
pai
achega
78a38d2a56
Modificáronse 1 ficheiros con 18 adicións e 15 borrados
  1. 18 15
      src/server/service/bolt.js

+ 18 - 15
src/server/service/bolt.js

@@ -236,8 +236,24 @@ class BoltService {
           {
           {
             type: 'actions',
             type: 'actions',
             elements: [
             elements: [
-              this.generateButtonBlock('Next', 'showNextResults'),
-              this.generateButtonBlock('Share', 'shareSearchResults', 'primary', `${keywordsAndDesc} \n\n ${urls.join('\n')}`),
+              {
+                type: 'button',
+                text: {
+                  type: 'plain_text',
+                  text: 'Next',
+                },
+                action_id: 'showNextResults',
+              },
+              {
+                type: 'button',
+                text: {
+                  type: 'plain_text',
+                  text: 'Share',
+                },
+                style: 'primary',
+                action_id: 'shareSearchResults',
+                value: `${keywordsAndDesc} \n\n ${urls.join('\n')}`,
+              },
             ],
             ],
           },
           },
         ],
         ],
@@ -342,19 +358,6 @@ class BoltService {
     }
     }
   }
   }
 
 
-  generateButtonBlock(text, actionId, style, value) {
-    return {
-      type: 'button',
-      text: {
-        type: 'plain_text',
-        text,
-      },
-      style,
-      action_id: actionId,
-      value,
-    };
-  }
-
   generateMarkdownSectionBlock(blocks) {
   generateMarkdownSectionBlock(blocks) {
     return {
     return {
       type: 'section',
       type: 'section',