Przeglądaj źródła

Merge pull request #3781 from weseek/fix/5544-6070-rename-vars

Fix/5544 6070 rename vars
itizawa 4 lat temu
rodzic
commit
4c2ac5adc2

+ 5 - 5
packages/slackbot-proxy/src/controllers/growi-to-slack.ts

@@ -34,7 +34,7 @@ export class GrowiToSlackCtrl {
   @Inject()
   orderRepository: OrderRepository;
 
-  async requestToGrowi(growiUrl:string, proxyAccessToken:string):Promise<void> {
+  async requestToGrowi(growiUrl:string, tokenPtoG:string):Promise<void> {
     const url = new URL('/_api/v3/slack-integration/proxied/commands', growiUrl);
     await axios.post(url.toString(), {
       type: 'url_verification',
@@ -42,7 +42,7 @@ export class GrowiToSlackCtrl {
     },
     {
       headers: {
-        'x-growi-ptog-tokens': proxyAccessToken,
+        'x-growi-ptog-tokens': tokenPtoG,
       },
     });
   }
@@ -112,7 +112,7 @@ export class GrowiToSlackCtrl {
     // retrieve latest Order with Installation
     const order = await this.orderRepository.createQueryBuilder('order')
       .orderBy('order.createdAt', 'DESC')
-      .where('proxyAccessToken = :token', { token: tokenGtoP })
+      .where('tokenGtoP = :token', { token: tokenGtoP })
       .leftJoinAndSelect('order.installation', 'installation')
       .getOne();
 
@@ -122,7 +122,7 @@ export class GrowiToSlackCtrl {
 
     // Access the GROWI URL saved in the Order record and check if the GtoP token is valid.
     try {
-      await this.requestToGrowi(order.growiUrl, order.proxyAccessToken);
+      await this.requestToGrowi(order.growiUrl, order.tokenPtoG);
     }
     catch (err) {
       logger.error(err);
@@ -142,7 +142,7 @@ export class GrowiToSlackCtrl {
 
     // Transaction is not considered because it is used infrequently,
     const createdRelation = await this.relationRepository.save({
-      installation: order.installation, tokenGtoP: order.growiAccessToken, tokenPtoG: order.proxyAccessToken, growiUri: order.growiUrl,
+      installation: order.installation, tokenGtoP: order.tokenGtoP, tokenPtoG: order.tokenPtoG, growiUri: order.growiUrl,
     });
 
     return res.send({ relation: createdRelation });

+ 2 - 2
packages/slackbot-proxy/src/entities/order.ts

@@ -25,10 +25,10 @@ export class Order {
   growiUrl: string;
 
   @Column()
-  growiAccessToken: string;
+  tokenGtoP: string;
 
   @Column()
-  proxyAccessToken: string;
+  tokenPtoG: string;
 
   isExpired():boolean {
     const now = Date.now();

+ 7 - 7
packages/slackbot-proxy/src/services/RegisterService.ts

@@ -34,9 +34,9 @@ export class RegisterService implements GrowiCommandProcessor {
         private_metadata: JSON.stringify({ channel: body.channel_name }),
 
         blocks: [
-          generateInputSectionBlock('growiDomain', 'GROWI domain', 'contents_input', false, 'https://example.com'),
-          generateInputSectionBlock('growiAccessToken', 'GROWI ACCESS_TOKEN', 'contents_input', false, 'jBMZvpk.....'),
-          generateInputSectionBlock('proxyToken', 'PROXY ACCESS_TOKEN', 'contents_input', false, 'jBMZvpk.....'),
+          generateInputSectionBlock('growiUrl', 'GROWI domain', 'contents_input', false, 'https://example.com'),
+          generateInputSectionBlock('tokenPtoG', 'Access Token Proxy to GROWI', 'contents_input', false, 'jBMZvpk.....'),
+          generateInputSectionBlock('tokenGtoP', 'Access Token GROWI to Proxy', 'contents_input', false, 'sdg15av.....'),
         ],
       },
     });
@@ -47,12 +47,12 @@ export class RegisterService implements GrowiCommandProcessor {
       orderRepository: OrderRepository, installation: Installation | undefined, payload: any,
   ): Promise<void> {
     const inputValues = payload.view.state.values;
-    const inputGrowiUrl = inputValues.growiDomain.contents_input.value;
-    const inputGrowiAccessToken = inputValues.growiAccessToken.contents_input.value;
-    const inputProxyAccessToken = inputValues.proxyToken.contents_input.value;
+    const growiUrl = inputValues.growiUrl.contents_input.value;
+    const tokenPtoG = inputValues.tokenPtoG.contents_input.value;
+    const tokenGtoP = inputValues.tokenGtoP.contents_input.value;
 
     orderRepository.save({
-      installation, growiUrl: inputGrowiUrl, growiAccessToken: inputGrowiAccessToken, proxyAccessToken: inputProxyAccessToken,
+      installation, growiUrl, tokenPtoG, tokenGtoP,
     });
   }
 

+ 1 - 1
resource/locales/en_US/admin/admin.json

@@ -312,7 +312,7 @@
       "register_for_growi_official_bot_proxy_service": "Register for GROWI Official Bot Proxy Service",
       "enter_growi_register_on_slack": "Enter <b>/growi register</b> on slack",
       "paste_growi_url": "Since a modal is displayed, enter the following URL in <b>GROWI URL</b>.",
-      "enter_access_token_for_growi_and_proxy": "Enter <b>Access Token for GROWI</b> and <b>Access Token for Proxy</b>",
+      "enter_access_token_for_growi_and_proxy": "Enter <b>Access Token Proxy to GROWI</b> and <b>Access Token GROWI to Proxy</b>",
       "set_proxy_url_on_growi": "Set Proxy URL on GROWI",
       "copy_proxy_url": "1. When the above step ② are completed successfully, the Proxy URL will be displayed in the Slack Channel you selected in the modal, so copy it.",
       "enter_proxy_url_and_update": "2. Enter and update the Proxy URL that you copied in step ③ in the <b>Proxy URL</b>  of the <b>Custom bot with proxy integration</b> on this page.",

+ 1 - 1
resource/locales/ja_JP/admin/admin.json

@@ -309,7 +309,7 @@
       "register_for_growi_official_bot_proxy_service": "GROWI Official Bot Proxy サービスへの登録",
       "enter_growi_register_on_slack": "Slack上で <b>/growi register</b> と打ちます。",
       "paste_growi_url": "モーダルが表示されるので、<b>GROWI URL</b> には下記のURLを入力します。",
-      "enter_access_token_for_growi_and_proxy": "上記で発行した<b>Access Token for GROWI</b> と <b>Access Token for Proxy</b>を入れる",
+      "enter_access_token_for_growi_and_proxy": "上記で発行した<b>Access Token Proxy to GROWI</b> と <b>Access Token GROWI to Proxy</b>を入れる",
       "set_proxy_url_on_growi": "ProxyのURLをGROWIに登録する",
       "copy_proxy_url": "1. ②が正常に完了すると、モーダル内で選択したSlack ChannelにProxy URLが表示されるので、コピーします。",
       "enter_proxy_url_and_update": "2. 連携手順③でコピーしたProxy URLを、このページの<b>Custom bot with proxy 連携</b>の<b>Proxy URL</b>に入力、更新します。",

+ 1 - 1
resource/locales/zh_CN/admin/admin.json

@@ -319,7 +319,7 @@
       "register_for_growi_official_bot_proxy_service": "注册 GROWI Official Bot Proxy Service",
       "enter_growi_register_on_slack": "在Slack中,输入 <b>/growi register</b>",
       "paste_growi_url": "由于显示了模式,请在 <b>GROWI URL</b> 中输入以下URL",
-      "enter_access_token_for_growi_and_proxy": "插入上面发出的 <b>Access Token for GROWI</b> 和 <b>Access Token for Proxy</b>。",
+      "enter_access_token_for_growi_and_proxy": "插入上面发出的 <b>Access Token Proxy to GROWI</b> 和 <b>Access Token GROWI to Proxy</b>。",
       "set_proxy_url_on_growi": "向GROWI注册Proxy的URL",
       "copy_proxy_url": "1. 当上述步骤②成功完成后,Proxy URL将显示在你在模版中选择的Slack频道中,所以请复制它。",
       "enter_proxy_url_and_update": "2. 输入并更新你在步骤③中复制的ProxyURL到本页的<b>Custom bot with proxy 一体化</b>的<b>ProxyURL</b>。",

+ 2 - 2
src/client/js/components/Admin/SlackIntegration/WithProxyAccordions.jsx

@@ -89,7 +89,7 @@ const GeneratingTokensAndRegisteringProxyServiceProcess = withUnstatedContainers
     <div className="py-4 px-5">
       <p className="font-weight-bold">1. {t('admin:slack_integration.accordion.generate_access_token')}</p>
       <div className="form-group row">
-        <label className="text-left text-md-right col-md-3 col-form-label">Access Token for GROWI</label>
+        <label className="text-left text-md-right col-md-3 col-form-label">Access Token Proxy to GROWI</label>
         <div className="col-md-6">
           <div className="input-group-prepend mx-1">
             {/* TODO: show tokenPtoG GW-5899 */}
@@ -103,7 +103,7 @@ const GeneratingTokensAndRegisteringProxyServiceProcess = withUnstatedContainers
         </div>
       </div>
       <div className="form-group row">
-        <label className="text-left text-md-right col-md-3 col-form-label">Access Token for Proxy</label>
+        <label className="text-left text-md-right col-md-3 col-form-label">Access Token GROWI to Proxy</label>
         <div className="col-md-6">
           <div className="input-group-prepend mx-1">
             {/* TODO: show tokenGtoP GW-5899 */}