Refactor message grouping from data layer to render layer

This commit is contained in:
Oleksii Holub
2018-11-01 18:16:23 +02:00
parent 23116b776b
commit 47f0561c71
18 changed files with 124 additions and 189 deletions

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace DiscordChatExporter.Core.Models
{
@@ -14,21 +13,18 @@ namespace DiscordChatExporter.Core.Models
public DateTime? To { get; }
public IReadOnlyList<MessageGroup> MessageGroups { get; }
public long TotalMessageCount { get; }
public IReadOnlyList<Message> Messages { get; }
public Mentionables Mentionables { get; }
public ChatLog(Guild guild, Channel channel, DateTime? from, DateTime? to,
IReadOnlyList<MessageGroup> messageGroups, long totalMessageCount, Mentionables mentionables)
IReadOnlyList<Message> messages, Mentionables mentionables)
{
Guild = guild;
Channel = channel;
From = from;
To = to;
MessageGroups = messageGroups;
TotalMessageCount = totalMessageCount;
Messages = messages;
Mentionables = mentionables;
}

View File

@@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
namespace DiscordChatExporter.Core.Models
{
public class MessageGroup
{
public User Author { get; }
public DateTime Timestamp { get; }
public IReadOnlyList<Message> Messages { get; }
public MessageGroup(User author, DateTime timestamp, IReadOnlyList<Message> messages)
{
Author = author;
Timestamp = timestamp;
Messages = messages;
}
public override string ToString() => $"{Author.FullName} | {Timestamp} | {Messages.Count} messages";
}
}