Resolves issue where muted player would be unmuted when flag penalty was removed (#303)

* resolves issue where muted player would be unmuted when flag penalty was removed

* Revert accidental code format
This commit is contained in:
Amos
2023-05-28 17:37:27 +01:00
committed by GitHub
parent 108dddb5cc
commit cdf9485903
2 changed files with 4 additions and 2 deletions

View File

@ -215,7 +215,8 @@ namespace SharedLibraryCore.Services
return await activePenaltiesIds.Select(ids => ids.Penalty).ToListAsync();
}
public virtual async Task RemoveActivePenalties(int aliasLinkId, long networkId, Reference.Game game, int? ipAddress = null)
public virtual async Task RemoveActivePenalties(int aliasLinkId, long networkId, Reference.Game game, int? ipAddress = null,
EFPenalty.PenaltyType[] penaltyTypes = null)
{
await using var context = _contextFactory.CreateContext();
var now = DateTime.UtcNow;
@ -226,6 +227,7 @@ namespace SharedLibraryCore.Services
{
var ids = activePenalties.Select(penalty => penalty.PenaltyId);
await context.Penalties.Where(penalty => ids.Contains(penalty.PenaltyId))
.Where(pen => penaltyTypes == null || penaltyTypes.Contains(pen.Type))
.ForEachAsync(penalty =>
{
penalty.Active = false;