Add notification for ticket reopening to Telegram admins
- Implemented NotifyAdminsTicketReopenedAsync method in TelegramNotifier to notify admins when a ticket is reopened, including a link to the ticket on the public site. - Updated ITelegramNotifier interface to include the new notification method. - Modified ReopenTicketCommandHandler to invoke the new notification method after a ticket is reopened. - Enhanced unit tests for ReopenTicketCommandHandler to verify the notification functionality.
This commit is contained in:
@@ -7,7 +7,7 @@ using PnvPanel.Domain.Support;
|
||||
|
||||
namespace PnvPanel.Application.Support.Reopen;
|
||||
|
||||
public sealed class ReopenTicketCommandHandler(IAppDbContext dbContext, ICurrentUser currentUser)
|
||||
public sealed class ReopenTicketCommandHandler(IAppDbContext dbContext, ITelegramNotifier telegramNotifier, ICurrentUser currentUser)
|
||||
: ICommandHandler<ReopenTicketCommand, Result>
|
||||
{
|
||||
public async Task<Result> Handle(ReopenTicketCommand command, CancellationToken cancellationToken)
|
||||
@@ -24,6 +24,10 @@ public sealed class ReopenTicketCommandHandler(IAppDbContext dbContext, ICurrent
|
||||
return Result.Failure(SupportErrors.NotResolved);
|
||||
|
||||
ticket.Reopen();
|
||||
|
||||
var userName = currentUser.UserName ?? userId.ToString();
|
||||
await telegramNotifier.NotifyAdminsTicketReopenedAsync(ticket.Id, userName, ticket.Type, cancellationToken);
|
||||
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user