itizawa 4 лет назад
Родитель
Сommit
217f451d75

+ 14 - 0
packages/slackbot-proxy/src/services/growi-uri-injector/GrowiUriInjectionButtonDelegator.ts

@@ -0,0 +1,14 @@
+import { GrowiUriInjector } from './GrowiUriInjector';
+
+export class GrowiUriInjectionButtonDelegator implements GrowiUriInjector {
+
+
+  inject(body: any): any {
+    return body;
+  }
+
+  extract(block: any): any {
+    return block;
+  }
+
+}

+ 19 - 0
packages/slackbot-proxy/src/services/growi-uri-injector/GrowiUriInjectionModalDelegator.ts

@@ -0,0 +1,19 @@
+import { GrowiUriInjector } from './GrowiUriInjector';
+
+export class GrowiUriInjectionModalDelegator implements GrowiUriInjector {
+
+
+  inject(body: any, growiUri:string): any {
+    if (body.view != null) {
+      const parsedView = JSON.parse(body.view as string);
+      parsedView.private_metadata = JSON.stringify({ growiUri });
+      body.view = JSON.stringify(parsedView);
+    }
+    return body;
+  }
+
+  extract(body: any): string {
+    return body;
+  }
+
+}