Show threads in GUI at the bottom of the list, in specialized groups

Related to #1119
This commit is contained in:
Tyrrrz 2023-08-28 21:31:51 +03:00
parent f1c094ac14
commit 5f6e51f6fb
11 changed files with 49 additions and 13 deletions

View file

@ -24,7 +24,7 @@ public partial record Channel(
// channels without a parent (i.e. mostly DM channels) or channels
// with an inaccessible parent (i.e. inside private categories) had
// a fallback category created for them.
public string Category =>
public string ParentNameWithFallback =>
Parent?.Name
?? Kind switch
{
@ -41,6 +41,9 @@ public partial record Channel(
// Only needed for WPF data binding. Don't use anywhere else.
public bool IsVoice => Kind.IsVoice();
// Only needed for WPF data binding. Don't use anywhere else.
public bool IsThread => Kind.IsThread();
}
public partial record Channel

View file

@ -92,7 +92,9 @@ public partial class ExportRequest
var buffer = new StringBuilder();
// Guild and channel names
buffer.Append($"{guild.Name} - {channel.Category} - {channel.Name} [{channel.Id}]");
buffer.Append(
$"{guild.Name} - {channel.ParentNameWithFallback} - {channel.Name} [{channel.Id}]"
);
// Date range
if (after is not null || before is not null)

View file

@ -273,7 +273,7 @@ internal class JsonMessageWriter : MessageWriter
_writer.WriteString("id", Context.Request.Channel.Id.ToString());
_writer.WriteString("type", Context.Request.Channel.Kind.ToString());
_writer.WriteString("categoryId", Context.Request.Channel.Parent?.Id.ToString());
_writer.WriteString("category", Context.Request.Channel.Category);
_writer.WriteString("category", Context.Request.Channel.ParentNameWithFallback);
_writer.WriteString("name", Context.Request.Channel.Name);
_writer.WriteString("topic", Context.Request.Channel.Topic);

View file

@ -201,7 +201,7 @@ internal class PlainTextMessageWriter : MessageWriter
await _writer.WriteLineAsync(new string('=', 62));
await _writer.WriteLineAsync($"Guild: {Context.Request.Guild.Name}");
await _writer.WriteLineAsync(
$"Channel: {Context.Request.Channel.Category} / {Context.Request.Channel.Name}"
$"Channel: {Context.Request.Channel.ParentNameWithFallback} / {Context.Request.Channel.Name}"
);
if (!string.IsNullOrWhiteSpace(Context.Request.Channel.Topic))

View file

@ -1004,7 +1004,7 @@
</div>
<div class="preamble__entries-container">
<div class="preamble__entry">@Context.Request.Guild.Name</div>
<div class="preamble__entry">@Context.Request.Channel.Category / @Context.Request.Channel.Name</div>
<div class="preamble__entry">@Context.Request.Channel.ParentNameWithFallback / @Context.Request.Channel.Name</div>
@if (!string.IsNullOrWhiteSpace(Context.Request.Channel.Topic))
{