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

Show time passed since ban instead of "forever"

reworked event api to include all events (sans unknown)
This commit is contained in:
RaidMax
2018-06-16 21:11:25 -05:00
parent fc2b846a5c
commit f73ddf5ad1
19 changed files with 861 additions and 128 deletions

View File

@ -9,13 +9,10 @@ namespace WebfrontCore.Controllers.API
{
[HttpGet]
[Route("event")]
public ActionResult Index()
public ActionResult Index(bool shouldConsume = true)
{
var events = Manager.GetEventApi().GetEvents();
var eventsDto = new List<EventInfo>();
while (events.Count > 0)
eventsDto.Add(events.Dequeue());
return Json(eventsDto);
var events = Manager.GetEventApi().GetEvents(shouldConsume);
return Json(events);
}
}
}

View File

@ -24,7 +24,8 @@ namespace WebfrontCore.ViewComponents
Offense = User.Identity.IsAuthenticated && !string.IsNullOrEmpty(p.AutomatedOffense) ? p.AutomatedOffense : p.Offense,
Type = p.Type.ToString(),
TimePunished = Utilities.GetTimePassed(p.When, false),
TimeRemaining = DateTime.UtcNow > p.Expires ? "" : Utilities.TimeSpanText(p.Expires - DateTime.UtcNow),
// show time passed if ban
TimeRemaining = DateTime.UtcNow > p.Expires ? "" : $"{(p.Expires.Year == DateTime.MaxValue.Year ? Utilities.GetTimePassed(p.When, true) : Utilities.TimeSpanText(p.Expires - DateTime.UtcNow))}",
Sensitive = p.Type == Penalty.PenaltyType.Flag,
AutomatedOffense = p.AutomatedOffense
});

View File

@ -70,7 +70,7 @@
}
else
{
<span> @Model.TimeRemaining @loc["WEBFRONT_PENALTY_TEMPLATE_REMAINING"]</span>
<span> @Model.TimeRemaining <!-- @loc["WEBFRONT_PENALTY_TEMPLATE_REMAINING"] --></span>
}
}
</td>