File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,26 @@ async def get_is_stale(ts: str, max_retries: int = 3) -> bool:
4747                    f"Thread not found for ticket { ts }  . This might be a deleted thread." 
4848                )
4949                await  send_heartbeat (f"Thread not found for ticket { ts }  ." )
50-                 await  env .db .ticket .update (
51-                     where = {"msgTs" : ts },
52-                     data = {
53-                         "status" : TicketStatus .CLOSED ,
54-                         "closedAt" : datetime .now (),
55-                         "closedBy" : {"connect" : {"slackId" : env .slack_maintainer_id }},
56-                     },
50+                 maintainer_user  =  await  env .db .user .find_unique (
51+                     where = {"slackId" : env .slack_maintainer_id }
5752                )
53+                 if  maintainer_user :
54+                     await  env .db .ticket .update (
55+                         where = {"msgTs" : ts },
56+                         data = {
57+                             "status" : TicketStatus .CLOSED ,
58+                             "closedAt" : datetime .now (),
59+                             "closedBy" : {"connect" : {"id" : maintainer_user .id }},
60+                         },
61+                     )
62+                 else :
63+                     await  env .db .ticket .update (
64+                         where = {"msgTs" : ts },
65+                         data = {
66+                             "status" : TicketStatus .CLOSED ,
67+                             "closedAt" : datetime .now (),
68+                         },
69+                     )
5870                return  False 
5971            else :
6072                logging .error (
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments