fix(bot): skip join-link reminders without links
PR Checks / test-and-build (pull_request) Failing after 20m55s
PR Checks / test-and-build (pull_request) Failing after 20m55s
Prevent offline sessions with empty join links from entering the 5-minute join-link notification flow, omit blank link lines from direct reminders, and add offline persistence/reminder regression coverage.
This commit is contained in:
+45
@@ -144,4 +144,49 @@ public sealed class CreateSessionHandlerIntegrationTests(CreateSessionHandlerPos
|
||||
Assert.Equal("Online room notes", reader.GetString(2));
|
||||
Assert.False(await reader.ReadAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandleAsync_OfflineSession_PersistsFormatAndLocationAddress()
|
||||
{
|
||||
var connectionString = await fixture.CreateMigratedDatabaseAsync();
|
||||
await using var dataSource = NpgsqlDataSource.Create(connectionString);
|
||||
var sut = new CreateSessionHandler(dataSource);
|
||||
|
||||
var result = await sut.HandleAsync(
|
||||
new CreateSessionCommand(
|
||||
new PlatformUser(PlatformKind.Telegram, "333333333", "Offline GM", "offline_gm"),
|
||||
new PlatformGroup(PlatformKind.Telegram, "444444444", "Offline Group"),
|
||||
"Offline Adventure",
|
||||
string.Empty,
|
||||
[DateTimeOffset.UtcNow.AddDays(1)],
|
||||
4,
|
||||
null,
|
||||
GameSystem.Dnd5e,
|
||||
"Offline integration regression test",
|
||||
"Offline",
|
||||
240,
|
||||
true,
|
||||
"Москва, ул. Кубиков, 12"),
|
||||
CancellationToken.None);
|
||||
|
||||
Assert.True(result.Success, result.ErrorMessage);
|
||||
Assert.NotNull(result.BatchId);
|
||||
|
||||
await using var connection = await dataSource.OpenConnectionAsync();
|
||||
await using var command = new NpgsqlCommand(
|
||||
"""
|
||||
SELECT join_link, format, location_address
|
||||
FROM sessions
|
||||
WHERE batch_id = @batch_id
|
||||
""",
|
||||
connection);
|
||||
command.Parameters.AddWithValue("batch_id", result.BatchId.Value);
|
||||
|
||||
await using var reader = await command.ExecuteReaderAsync();
|
||||
Assert.True(await reader.ReadAsync());
|
||||
Assert.Equal(string.Empty, reader.GetString(0));
|
||||
Assert.Equal("Offline", reader.GetString(1));
|
||||
Assert.Equal("Москва, ул. Кубиков, 12", reader.GetString(2));
|
||||
Assert.False(await reader.ReadAsync());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user