From 61516feafaea354c0ca0cebf18522eee84375b45 Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 13 Sep 2022 17:33:28 +0300 Subject: [PATCH] Refactor --- .../Discord/Data/Embeds/GifvEmbedProjection.cs | 3 +-- DiscordChatExporter.Core/Discord/Data/Message.cs | 2 +- .../Exporting/Writers/Html/MessageGroupTemplate.cshtml | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/DiscordChatExporter.Core/Discord/Data/Embeds/GifvEmbedProjection.cs b/DiscordChatExporter.Core/Discord/Data/Embeds/GifvEmbedProjection.cs index 2ef8cb7..7388b34 100644 --- a/DiscordChatExporter.Core/Discord/Data/Embeds/GifvEmbedProjection.cs +++ b/DiscordChatExporter.Core/Discord/Data/Embeds/GifvEmbedProjection.cs @@ -1,5 +1,4 @@ using System; -using System.Text.RegularExpressions; namespace DiscordChatExporter.Core.Discord.Data.Embeds; @@ -10,7 +9,7 @@ public partial record GifvEmbedProjection(string Url) if (string.IsNullOrWhiteSpace(embed.Url)) return null; - if (embed.Video is null || string.IsNullOrWhiteSpace(embed.Video.Url)) + if (string.IsNullOrWhiteSpace(embed.Video?.Url)) return null; if (!string.Equals(embed.Type, "gifv", StringComparison.OrdinalIgnoreCase)) diff --git a/DiscordChatExporter.Core/Discord/Data/Message.cs b/DiscordChatExporter.Core/Discord/Data/Message.cs index 1a67e0e..0efd0fc 100644 --- a/DiscordChatExporter.Core/Discord/Data/Message.cs +++ b/DiscordChatExporter.Core/Discord/Data/Message.cs @@ -44,7 +44,7 @@ public record Message( { var embed = embeds[i]; - if (embed.Url?.Contains("://twitter.com/") == true) + if (embed.Url?.Contains("://twitter.com/", StringComparison.OrdinalIgnoreCase) == true) { // Find embeds with the same URL that only contain a single image and nothing else var trailingEmbeds = embeds diff --git a/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplate.cshtml b/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplate.cshtml index 9b87213..f7e327a 100644 --- a/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplate.cshtml +++ b/DiscordChatExporter.Core/Exporting/Writers/Html/MessageGroupTemplate.cshtml @@ -211,12 +211,12 @@ // Gifv embed if (embed.TryGetGifv() is { } gifvEmbed) { - @if (embed.Video is not null && !string.IsNullOrWhiteSpace(embed.Video.Url) && embed.Thumbnail is not null) + @if (!string.IsNullOrWhiteSpace(embed.Video?.Url)) {
- +
} }