Skip to content

Commit

Permalink
Don't use a username for exact check of a profile (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaphireLattice authored Dec 12, 2024
1 parent fb62642 commit 06fe6c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ReplayBrowser/Helpers/ReplayHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 =>
{
Expand All @@ -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)
Expand Down

0 comments on commit 06fe6c7

Please sign in to comment.