zahmis 4 лет назад
Родитель
Сommit
4dafca0d73

+ 3 - 3
packages/slackbot-proxy/src/middlewares/slack-to-growi/checkCommandPermission.ts

@@ -135,7 +135,7 @@ export class checkCommandPermissionMiddleware implements IMiddleware {
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     console.log(118, targetCommand);
 
-    const permittedChannels = channelsObject![targetCommand!];
+    const permittedChannels = channelsObject?.[targetCommand!];
     console.log(permittedChannels);
 
     let fromChannel:string;
@@ -153,7 +153,7 @@ export class checkCommandPermissionMiddleware implements IMiddleware {
 
     }
 
-    const isPermittedChannel = permittedChannels.includes(fromChannel);
+    const isPermittedChannel = permittedChannels?.includes(fromChannel);
     console.log(151, isPermittedChannel);
     if (isPermittedChannel) {
       return next();
@@ -161,7 +161,7 @@ export class checkCommandPermissionMiddleware implements IMiddleware {
 
 
     if (payload != null) {
-      const isPermittedChannel = permittedChannels.includes(fromChannel);
+      const isPermittedChannel = permittedChannels?.includes(fromChannel);
       if (isPermittedChannel) {
         return next();
       }