From d94ac68159dccb8d3433f1908fd0c04f4d7f32f4 Mon Sep 17 00:00:00 2001 From: Saphire Date: Fri, 13 Dec 2024 01:08:36 +0600 Subject: [PATCH] Don't use a username for exact check of a profile --- ReplayBrowser/Helpers/ReplayHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReplayBrowser/Helpers/ReplayHelper.cs b/ReplayBrowser/Helpers/ReplayHelper.cs index f3f074e..50de180 100644 --- a/ReplayBrowser/Helpers/ReplayHelper.cs +++ b/ReplayBrowser/Helpers/ReplayHelper.cs @@ -342,7 +342,7 @@ public static void CheckAccountAccess(Account? caller, Account? found) var account = await _context.Accounts .Include(a => a.Settings) - .FirstOrDefaultAsync(a => a.Username == username); + .FirstOrDefaultAsync(a => a.Guid == player.PlayerGuid); if (account != null && account.Settings.RedactInformation && account.Guid != accountGuid) { @@ -405,6 +405,7 @@ public static void CheckAccountAccess(Account? caller, Account? found) }; } + // Get total result count, cache it // Technically it might be inaccurate. In practice nobody will care much? int totalItems = _cache.GetOrCreate(cacheKey, e => { @@ -413,7 +414,6 @@ public static void CheckAccountAccess(Account? caller, Account? found) return queryable.Count(); }); - // Get all results and store them in the cache var allResults = queryable .OrderByDescending(r => r.Date ?? DateTime.MinValue) .Skip(page * pageSize)