mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-22 22:18:24 +00:00
Resolve thread mentions on demand (#1480)
* Initial plan * Fix unresolved thread mentions in HTML export (#1261) - Add TryGetChannelAsync to DiscordClient for on-demand channel/thread lookup - Add PopulateChannelAsync to ExportContext with negative caching - Update HtmlMarkdownVisitor to resolve thread mentions on demand Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> * Refactor GetChannelAsync to use TryGetChannelAsync for parent resolution Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> * Add test for thread mention resolution in HTML export Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> * Apply PopulateChannelAsync to PlainTextMarkdownVisitor; add JSON thread mention test Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
@@ -61,4 +61,17 @@ public class HtmlMentionSpecs
|
||||
// Assert
|
||||
message.Text().Should().Contain("Role mention: @Role 1");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task I_can_export_a_channel_that_contains_a_message_with_a_thread_mention()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsHtmlAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("1474874276828938290")
|
||||
);
|
||||
|
||||
// Assert
|
||||
message.Text().Should().Contain("Thread mention: #Thread starting message");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,4 +75,21 @@ public class JsonMentionSpecs
|
||||
// Assert
|
||||
message.GetProperty("content").GetString().Should().Be("Role mention: @Role 1");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task I_can_export_a_channel_that_contains_a_message_with_a_thread_mention()
|
||||
{
|
||||
// Act
|
||||
var message = await ExportWrapper.GetMessageAsJsonAsync(
|
||||
ChannelIds.MentionTestCases,
|
||||
Snowflake.Parse("1474874276828938290")
|
||||
);
|
||||
|
||||
// Assert
|
||||
message
|
||||
.GetProperty("content")
|
||||
.GetString()
|
||||
.Should()
|
||||
.Be("Thread mention: #Thread starting message");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user