diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs index eee8df5e..b87d3ddd 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.GeneralNotesSection.cs @@ -439,12 +439,13 @@ internal static partial class LogParserResult if (items["game_mod"] is string mod) notes.Add($"⚠️ Game files modification present: `{mod.Trim(20)}`"); - var updateInfo = await CheckForUpdateAsync(items).ConfigureAwait(false); var buildBranch = items["build_branch"]?.ToLowerInvariant(); + var (updateInfo, isTooOld) = await CheckForUpdateAsync(items).ConfigureAwait(false); if (updateInfo is not null + && isTooOld && (buildBranch is "master" or "head" or "spu_perf" || buildBranch is not {Length: >0} - && (updateInfo.X64?.CurrentBuild is not null || updateInfo.Arm?.CurrentBuild is not null))) + && (updateInfo.X64?.CurrentBuild is not null || updateInfo.Arm?.CurrentBuild is not null))) { string prefix = "⚠️"; string timeDeltaStr; diff --git a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs index 40d124cc..e8f81871 100644 --- a/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs +++ b/CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs @@ -775,10 +775,10 @@ internal static partial class LogParserResult } } - private static async ValueTask CheckForUpdateAsync(NameValueCollection items) + private static async ValueTask<(UpdateInfo? updateInfo, bool isTooOld)> CheckForUpdateAsync(NameValueCollection items) { if (string.IsNullOrEmpty(items["build_and_specs"])) - return null; + return default; var currentBuildCommit = items["build_commit"]; if (string.IsNullOrEmpty(currentBuildCommit)) @@ -793,13 +793,13 @@ internal static partial class LogParserResult ?? updateInfo.Arm?.LatestBuild.Linux?.Download ?? updateInfo.Arm?.LatestBuild.Mac?.Download; if (updateInfo.ReturnCode is not StatusCode.UpdatesAvailable || link is null) - return null; + return default; var latestBuildInfo = BuildInfoInUpdate().Match(link.ToLowerInvariant()); if (latestBuildInfo.Success && VersionIsTooOld(items, latestBuildInfo, updateInfo)) - return updateInfo; + return (updateInfo, true); - return null; + return (updateInfo, false); } private static bool VersionIsTooOld(NameValueCollection items, Match update, UpdateInfo updateInfo)