@@ -438,12 +438,13 @@ async def assign(self, ctx: discord.ApplicationContext, ticket_id:int, member:di
438438
439439
440440 async def create_thread (self , ticket :Ticket , ctx :discord .ApplicationContext ):
441- log .info (f"creating a new thread for ticket #{ ticket .id } in channel: { ctx .channel } " )
441+ log .info (f"creating a new thread for ticket #{ ticket .id } in channel: { ctx .channel . name } " )
442442 thread_name = f"Ticket #{ ticket .id } : { ticket .subject } "
443443 if isinstance (ctx .channel , discord .Thread ):
444- log .debug (f"creating thread in parent channel { ctx .channel .parent } , for { ticket } " )
444+ log .debug (f"creating thread in parent channel { ctx .channel .parent . name } , for { ticket } " )
445445 thread = await ctx .channel .parent .create_thread (name = thread_name , type = discord .ChannelType .public_thread )
446446 else :
447+ log .debug (f"creating thread in channel { ctx .channel .name } , for { ticket } " )
447448 thread = await ctx .channel .create_thread (name = thread_name , type = discord .ChannelType .public_thread )
448449 # ticket-614: Creating new thread should post the ticket details to the new thread
449450 await thread .send (self .bot .formatter .format_ticket_details (ticket ))
@@ -520,10 +521,11 @@ async def thread(self, ctx: discord.ApplicationContext, ticket_id:int):
520521
521522 # check if sync data exists for a different channel
522523 synced = ticket .get_sync_record ()
523- if synced and synced .channel_id != ctx .channel_id :
524+ if synced and synced .channel_id != ctx .channel . id :
524525 thread = self .bot .get_channel (synced .channel_id )
525526 if thread :
526- await ctx .respond (f"Ticket { ticket_link } already synced with { thread .jump_url } " )
527+ url = thread .jump_url
528+ await ctx .respond (f"Ticket { ticket_link } already synced with { url } " )
527529 return # stop processing
528530 else :
529531 log .info (f"Ticket { ticket_id } synced with unknown thread ID { synced .channel_id } . Recovering." )
@@ -533,14 +535,17 @@ async def thread(self, ctx: discord.ApplicationContext, ticket_id:int):
533535
534536 # create the thread...
535537 thread = await self .create_thread (ticket , ctx )
538+ url = thread .jump_url
536539
537540 # update the discord flag on tickets, add a note with url of thread; thread.jump_url
538- note = f"Created Discord thread: { thread .name } : { thread .jump_url } "
541+ name = thread .name
542+ note = f"Created Discord thread: { name } : { url } "
539543 user = self .redmine .user_mgr .find_discord_user (ctx .user .name )
540- self .redmine .enable_discord_sync (ticket .id , user , note )
544+ self .redmine .ticket_mgr . enable_discord_sync (ticket .id , user , note )
541545
542546 # ticket-614: add ticket link to thread response
543- await ctx .respond (f"Created new thread { thread .jump_url } for ticket { ticket_link } " )
547+ log .info ('CTX5 %s' , vars (ctx ))
548+ await ctx .respond (f"Created new thread { url } for ticket { ticket_link } " )
544549 else :
545550 await ctx .respond (f"ERROR: Unkown ticket ID: { ticket_id } " )
546551
0 commit comments