1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 07:13:58 -05:00

Mute Banner for Profile & Prevent Self-Target & Correctly Expire Early Unmutes (#272)

* Fix self-targeting
Remove creation of penalty on mute expiration

* Display mute penalties on profile
Expire mute penalties on unmute

* Resolves issues in code review
Added comment in ClientController.cs
Fixed order of operations in MuteManager.cs
Fixed condition in MuteManager.cs

* Fix self-targeting
Remove creation of penalty on mute expiration

* Display mute penalties on profile
Expire mute penalties on unmute

* Resolves issues in code review
Added comment in ClientController.cs
Fixed order of operations in MuteManager.cs
Fixed condition in MuteManager.cs

* Changed localisation value to be more generic
Fix null reference warning (it should never be null) (34da216)
This commit is contained in:
Amos
2022-10-25 00:58:12 +01:00
committed by GitHub
parent 1d6cc670d7
commit 7180bfe1fc
9 changed files with 72 additions and 21 deletions

View File

@ -162,7 +162,13 @@ namespace WebfrontCore.Controllers
});
}
clientDto.ActivePenalty = activePenalties.OrderByDescending(_penalty => _penalty.Type).FirstOrDefault();
// Reducing the enum value for Temp/Mute so bans appear in client banner first
clientDto.ActivePenalty = activePenalties.MaxBy(penalty => penalty.Type switch
{
EFPenalty.PenaltyType.TempMute => 0,
EFPenalty.PenaltyType.Mute => 1,
_ => (int)penalty.Type
});
clientDto.Meta.AddRange(Authorized ? meta : meta.Where(m => !m.IsSensitive));
var strippedName = clientDto.Name.StripColors();