Notify via Telegram about new support ticket comments
CI / Backend (build + test) (push) Failing after 6m7s
CI / Frontend (lint + typecheck + build) (push) Successful in 39s

Owner's reply goes to all admins (text preview + link to the ticket),
admin's reply goes to the ticket owner as a DM. The comment author is
never notified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mrleo1nidandClaude Opus 5.5 committed 2026-10-16 17:57:08 +03:00
1 parent 0dcbd4e2b8
commit 1bc86dc426
5 files changed
+117 -5

No files matched your search

@@ -14,6 +14,7 @@ public class AddTicketCommentCommandHandlerTests
private readonly IIdentityService _identityService = Substitute.For<IIdentityService>();
private readonly IFileStorage _fileStorage = Substitute.For<IFileStorage>();
private readonly IRealtimeNotifier _notifier = Substitute.For<IRealtimeNotifier>();
private readonly ITelegramNotifier _telegramNotifier = Substitute.For<ITelegramNotifier>();
private static CurrentUserProfile Profile(Guid userId, string role) =>
new(
@@ -51,6 +52,7 @@ public class AddTicketCommentCommandHandlerTests
_identityService,
_fileStorage,
_notifier,
_telegramNotifier,
currentUser
);
@@ -68,6 +70,22 @@ public class AddTicketCommentCommandHandlerTests
Arg.Any<Guid>(),
Arg.Any<CancellationToken>()
);
await _telegramNotifier
.DidNotReceive()
.NotifyUserAsync(
Arg.Any<Guid>(),
Arg.Any<string>(),
Arg.Any<string?>(),
Arg.Any<CancellationToken>()
);
await _telegramNotifier
.Received(1)
.NotifyAdminsTicketCommentAddedAsync(
ticket.Id,
"alice",
"апдейт",
Arg.Any<CancellationToken>()
);
}
[Fact]
@@ -90,6 +108,7 @@ public class AddTicketCommentCommandHandlerTests
_identityService,
_fileStorage,
_notifier,
_telegramNotifier,
currentUser
);
@@ -102,6 +121,22 @@ public class AddTicketCommentCommandHandlerTests
await _notifier
.Received(1)
.NotifyTicketUpdatedAsync(ticket.Id, ownerId, Arg.Any<CancellationToken>());
await _telegramNotifier
.Received(1)
.NotifyUserAsync(
ownerId,
Arg.Any<string>(),
$"/support?ticket={ticket.Id}",
Arg.Any<CancellationToken>()
);
await _telegramNotifier
.DidNotReceive()
.NotifyAdminsTicketCommentAddedAsync(
Arg.Any<Guid>(),
Arg.Any<string>(),
Arg.Any<string>(),
Arg.Any<CancellationToken>()
);
}
[Fact]
@@ -124,6 +159,7 @@ public class AddTicketCommentCommandHandlerTests
_identityService,
_fileStorage,
_notifier,
_telegramNotifier,
currentUser
);
@@ -156,6 +192,7 @@ public class AddTicketCommentCommandHandlerTests
_identityService,
_fileStorage,
_notifier,
_telegramNotifier,
currentUser
);