Skip to content

Commit

Permalink
Fix search not working for redacted accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Simyon264 committed May 18, 2024
1 parent 2d3963a commit a3c4c47
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ReplayBrowser/Helpers/ReplayHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,17 @@ public async Task<SearchResult> SearchReplays(SearchMode searchMode, string quer
var foundGuidAccount = _context.Accounts
.Include(a => a.Settings)
.FirstOrDefault(a => a.Guid.ToString().ToLower().Contains(query.ToLower()));

if (foundGuidAccount != null && foundGuidAccount.Settings.RedactInformation)
{
if (callerAccount != null)
{
if (callerAccount.Guid == foundGuidAccount.Guid)
{
break;
}
}

// if the requestor is not the found account and the requestor is not an admin, deny access
if (callerAccount == null || !callerAccount.IsAdmin)
{
Expand All @@ -305,6 +313,11 @@ public async Task<SearchResult> SearchReplays(SearchMode searchMode, string quer
.Include(a => a.Settings)
.FirstOrDefault(a => a.Username.ToLower().Contains(query.ToLower()));

if (callerAccount != null && callerAccount.Username.ToLower().Contains(query.ToLower()))
{
break;
}

if (foundOocAccount != null && foundOocAccount.Settings.RedactInformation)
{
// if the requestor is not the found account and the requestor is not an admin, deny access
Expand Down

0 comments on commit a3c4c47

Please sign in to comment.