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

+ 3 - 3
packages/slackbot-proxy/src/controllers/slack.ts

@@ -160,16 +160,16 @@ export class SlackCtrl {
     res.send();
 
     body.growiUrisForSinglePost = relations.filter((relation) => {
-      return relation.singlePostCommands.includes(growiCommand.growiCommandType);
+      return !relation.isExpiredCommands() && relation.singlePostCommands.includes(growiCommand.growiCommandType);
     }).map(relation => relation.growiUri);
 
 
-    if (body.growiUrisForSinglePost != null && body.growiUrisForSinglePost.length > 0) {
+    if (body.growiUrisForSinglePost.length > 0) {
       return this.selectGrowiService.process(growiCommand, authorizeResult, body);
     }
 
     const relationsForBroadcast = relations.filter((relation) => {
-      return relation.broadcastCommands.includes(growiCommand.growiCommandType);
+      return !relation.isExpiredCommands() && relation.broadcastCommands.includes(growiCommand.growiCommandType);
     });
 
     /*

+ 1 - 1
packages/slackbot-proxy/src/entities/relation.ts

@@ -39,7 +39,7 @@ export class Relation {
   @CreateDateColumn()
   expiredAtCommands: Date;
 
-  isExpired():boolean {
+  isExpiredCommands():boolean {
     const now = Date.now();
     return this.expiredAtCommands.getTime() < now;
   }