Skip to content

Commit

Permalink
Fix some more private profile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Simyon264 committed May 19, 2024
1 parent a3c4c47 commit d60b0e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
10 changes: 6 additions & 4 deletions ReplayBrowser/Helpers/ReplayHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,18 @@ public async Task<SearchResult> SearchReplays(SearchMode searchMode, string quer
case SearchMode.PlayerOocName:
var foundOocAccount = _context.Accounts
.Include(a => a.Settings)
.FirstOrDefault(a => a.Username.ToLower().Contains(query.ToLower()));
.FirstOrDefault(a => a.Username.ToLower().Equals(query.ToLower()));

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

if (foundOocAccount != null && foundOocAccount.Settings.RedactInformation)
{
// if the requestor is not the found account and the requestor is not an admin, deny access
if (callerAccount == null || !callerAccount.IsAdmin)
{
throw new UnauthorizedAccessException("The account you are trying to search for is private. Contact the account owner and ask them to make their account public.");
Expand Down
5 changes: 0 additions & 5 deletions ReplayBrowser/Pages/Account/Manage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ else
uri.searchParams.set("redact", redact);
window.location.href = uri;
});
// Remove current query string from URL
let uri = new URL(window.location.href);
uri.search = "";
window.history.replaceState({}, document.title, uri);
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion ReplayBrowser/Services/AccountService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void Dispose()
_cache.Dispose();
}

public async Task<Account>? GetAccount(AuthenticationState authstate)
public async Task<Account?> GetAccount(AuthenticationState authstate)
{
var guid = AccountHelper.GetAccountGuid(authstate);
using var scope = _scopeFactory.CreateScope();
Expand Down

0 comments on commit d60b0e7

Please sign in to comment.