From 11e3235d5d486dfeefe98d5e5f674ec1367f2b36 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 25 Mar 2019 21:12:16 -0500 Subject: [PATCH] fix issue with not loading last connection for admins continue work on fixing profile --- Plugins/ProfanityDeterment/Plugin.cs | 1 - SharedLibraryCore/Objects/EFClient.cs | 4 +- SharedLibraryCore/Services/ClientService.cs | 3 +- WebfrontCore/Controllers/HomeController.cs | 8 +- .../Views/Client/Profile/Index.cshtml | 132 ++++++++++-------- WebfrontCore/wwwroot/css/bootstrap-custom.css | 6 + .../wwwroot/css/bootstrap-custom.scss | 8 ++ 7 files changed, 92 insertions(+), 70 deletions(-) diff --git a/Plugins/ProfanityDeterment/Plugin.cs b/Plugins/ProfanityDeterment/Plugin.cs index 1eb54ca50..67712bc0e 100644 --- a/Plugins/ProfanityDeterment/Plugin.cs +++ b/Plugins/ProfanityDeterment/Plugin.cs @@ -7,7 +7,6 @@ using SharedLibraryCore; using SharedLibraryCore.Configuration; using SharedLibraryCore.Database.Models; using SharedLibraryCore.Interfaces; -using SharedLibraryCore.Objects; namespace IW4MAdmin.Plugins.ProfanityDeterment { diff --git a/SharedLibraryCore/Objects/EFClient.cs b/SharedLibraryCore/Objects/EFClient.cs index c29bc29ca..032740a25 100644 --- a/SharedLibraryCore/Objects/EFClient.cs +++ b/SharedLibraryCore/Objects/EFClient.cs @@ -566,7 +566,9 @@ namespace SharedLibraryCore.Database.Models #region CLIENT_GUID_TEMPBAN else { - var profileTempBan = ReceivedPenalties.FirstOrDefault(_penalty => _penalty.Type == Penalty.PenaltyType.TempBan && _penalty.Active); + var profileTempBan = ReceivedPenalties.FirstOrDefault(_penalty => _penalty.Type == Penalty.PenaltyType.TempBan && + _penalty.Active && + _penalty.Expires > DateTime.UtcNow); // they have an active tempban tied to their GUID if (profileTempBan != null) diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs index 6ff6699f3..19a25ec1c 100644 --- a/SharedLibraryCore/Services/ClientService.cs +++ b/SharedLibraryCore/Services/ClientService.cs @@ -384,7 +384,8 @@ namespace SharedLibraryCore.Services Level = client.Level, Password = client.Password, PasswordSalt = client.PasswordSalt, - NetworkId = client.NetworkId + NetworkId = client.NetworkId, + LastConnection = client.LastConnection }; #if DEBUG == true diff --git a/WebfrontCore/Controllers/HomeController.cs b/WebfrontCore/Controllers/HomeController.cs index c5b92349f..58cf2468e 100644 --- a/WebfrontCore/Controllers/HomeController.cs +++ b/WebfrontCore/Controllers/HomeController.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Diagnostics; +using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Mvc; -using SharedLibraryCore.Dtos; namespace WebfrontCore.Controllers { diff --git a/WebfrontCore/Views/Client/Profile/Index.cshtml b/WebfrontCore/Views/Client/Profile/Index.cshtml index 028aae786..a23e83ac6 100644 --- a/WebfrontCore/Views/Client/Profile/Index.cshtml +++ b/WebfrontCore/Views/Client/Profile/Index.cshtml @@ -6,88 +6,100 @@ string gravatarUrl = Model.Meta.FirstOrDefault(m => m.Key == "GravatarEmail")?.Value; bool isTempBanned = Model.ActivePenaltyType == "TempBan"; } -
-
+
+ +
+ +
@if (string.IsNullOrEmpty(gravatarUrl)) { @shortCode }
-
-
-
@Model.Name
-
-
@Model.Level @(isTempBanned ? $"({loc["WEBFRONT_PROFILE_TEMPBAN"]})" : "")
-
+ +
+
+
@Model.Name
+
+
+ @if (ViewBag.Authorized) + { +
+ }
@if (ViewBag.Authorized) { -
-
- @if (Model.LevelInt != -1) +
+ @foreach (var linked in Model.LinkedAccounts) { - + @Html.ActionLink(linked.Value.ToString("X"), "ProfileAsync", "Client", new { id = linked.Key }, new { @class = "link-inverse" })
} - @if (Model.LevelInt < (int)ViewBag.User.Level && !Model.HasActivePenalty) + @foreach (string alias in Model.Aliases) + { + @alias
+ } + + @foreach (string ip in Model.IPs) + { + @ip
+ } +
+ } +
+

+ + @Model.Level @(isTempBanned ? $"({loc["WEBFRONT_PROFILE_TEMPBAN"]})" : "") + +

+
+
+ @if (ViewBag.Authorized) + { +
+ + @if (Model.LevelInt != -1) + { + + } + @if (Model.LevelInt < (int)ViewBag.User.Level && !Model.HasActivePenalty) + { + + } + + @if (Model.LevelInt < (int)ViewBag.User.Level && Model.HasActivePenalty) + { + @if (isTempBanned) { + } - - @if (Model.LevelInt < (int)ViewBag.User.Level && Model.HasActivePenalty) + else { - @if (isTempBanned) - { - - - } - else - { - - } + } + } +
-
- @{ - foreach (var linked in Model.LinkedAccounts) - { - @Html.ActionLink(linked.Value.ToString("X"), "ProfileAsync", "Client", new { id = linked.Key }, new { @class = "link-inverse" })
- } - foreach (string alias in Model.Aliases) - { - @alias
- } + } - if (ViewBag.Authorized) - { - foreach (string ip in Model.IPs) - { - @ip
- } - } - } -
-
- - } -
@*
-
- @loc["WEBFRONT_PROFILE_PLAYER"] @Model.TimePlayed @loc["GLOBAL_TIME_HOURS"] +
+ @loc["WEBFRONT_PROFILE_PLAYER"] @Model.TimePlayed @loc["GLOBAL_TIME_HOURS"] +
+
+ @loc["WEBFRONT_PROFILE_FSEEN"] @Model.FirstSeen @loc["WEBFRONT_PENALTY_TEMPLATE_AGO"] +
+
+ @loc["WEBFRONT_PROFILE_LSEEN"] @Model.LastSeen @loc["WEBFRONT_PENALTY_TEMPLATE_AGO"] +
+
-
- @loc["WEBFRONT_PROFILE_FSEEN"] @Model.FirstSeen @loc["WEBFRONT_PENALTY_TEMPLATE_AGO"] +
-
- @loc["WEBFRONT_PROFILE_LSEEN"] @Model.LastSeen @loc["WEBFRONT_PENALTY_TEMPLATE_AGO"] -
-
-
-
-
-
-
*@ +
+
*@
diff --git a/WebfrontCore/wwwroot/css/bootstrap-custom.css b/WebfrontCore/wwwroot/css/bootstrap-custom.css index 7cab0b482..202dcc565 100644 --- a/WebfrontCore/wwwroot/css/bootstrap-custom.css +++ b/WebfrontCore/wwwroot/css/bootstrap-custom.css @@ -6444,3 +6444,9 @@ form *, select { .nav-tabs .nav-item { margin-bottom: 0; } + +.mt-n1 { + margin-top: -0.25rem !important; } + +.mt-n2 { + margin-top: -0.5rem !important; } diff --git a/WebfrontCore/wwwroot/css/bootstrap-custom.scss b/WebfrontCore/wwwroot/css/bootstrap-custom.scss index 931d99b63..c2a87ccd6 100644 --- a/WebfrontCore/wwwroot/css/bootstrap-custom.scss +++ b/WebfrontCore/wwwroot/css/bootstrap-custom.scss @@ -253,3 +253,11 @@ form *, select { .nav-tabs .nav-item { margin-bottom: 0; } + +.mt-n1 { + margin-top: -0.25rem !important; +} + +.mt-n2 { + margin-top: -0.5rem !important; +}