fix issue with not loading last connection for admins

continue work on fixing profile
This commit is contained in:
RaidMax 2019-03-25 21:12:16 -05:00
parent cae6d8389e
commit 11e3235d5d
7 changed files with 92 additions and 70 deletions

View File

@ -7,7 +7,6 @@ using SharedLibraryCore;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Database.Models;
using SharedLibraryCore.Interfaces;
using SharedLibraryCore.Objects;
namespace IW4MAdmin.Plugins.ProfanityDeterment
{

View File

@ -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)

View File

@ -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

View File

@ -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
{

View File

@ -6,24 +6,57 @@
string gravatarUrl = Model.Meta.FirstOrDefault(m => m.Key == "GravatarEmail")?.Value;
bool isTempBanned = Model.ActivePenaltyType == "TempBan";
}
<div id="profile_wrapper" class="pb-3 row d-flex flex-fill">
<div id="profile_avatar" class="text-center level-bgcolor-@Model.LevelInt @(isTempBanned ? "penalties-bgcolor-tempban" : "")" style="background-image:url('@string.Format("https://gravatar.com/avatar/{0}?size=168&default=blank&rating=pg", gravatarUrl)')">
<div class="row" style="background: white; height: 50px;"></div>
<div id="profile_wrapper" class="pb-3 row">
<!-- Initial/Avatar Column -->
<div id="profile_avatar" class="col-12 col-lg-2 text-center level-bgcolor-@Model.LevelInt @(isTempBanned ? "penalties-bgcolor-tempban" : "")" style="background-image:url('@string.Format("https://gravatar.com/avatar/{0}?size=168&default=blank&rating=pg", gravatarUrl)')">
@if (string.IsNullOrEmpty(gravatarUrl))
{
<span class="profile-shortcode">@shortCode</span>
}
</div>
<div class="">
<div class="text-center text-sm-left">
<div id="profile_name" class="client-name h1">@Model.Name</div>
<div id="profile_level" class="text-muted mb-2">
<h5><span class="level-color-@Model.LevelInt @(isTempBanned ? "penalties-color-tempban" : "")"><strong>@Model.Level @(isTempBanned ? $"({loc["WEBFRONT_PROFILE_TEMPBAN"]})" : "")</strong></span></h5>
<!-- Name/Level Column -->
<div class="text-center text-lg-left col-12 col-lg-8">
<div class="d-block d-lg-inline-flex align-self-start">
<div id="profile_name" class="client-name h1 mb-0 mt-n2">@Model.Name</div>
<br />
<br />
@if (ViewBag.Authorized)
{
<div id="profile_aliases_btn" class="oi oi-caret-bottom h3 ml-0 ml-lg-2 mb-0 mt-0 mt-lg-2 align-self-center"></div>
}
</div>
@if (ViewBag.Authorized)
{
<div id="profile_aliases" class="text-muted mt-2 mb-2">
@foreach (var linked in Model.LinkedAccounts)
{
@Html.ActionLink(linked.Value.ToString("X"), "ProfileAsync", "Client", new { id = linked.Key }, new { @class = "link-inverse" })<br />
}
@foreach (string alias in Model.Aliases)
{
@alias<br />
}
@foreach (string ip in Model.IPs)
{
<a class="ip-locate-link" href="#" data-ip="@ip">@ip</a><br />
}
</div>
}
<div id="profile_level" class="text-muted align-self-end">
<h4 class="mb-0">
<span class="level-color-@Model.LevelInt @(isTempBanned ? "penalties-color-tempban" : "")">
<strong>@Model.Level @(isTempBanned ? $"({loc["WEBFRONT_PROFILE_TEMPBAN"]})" : "")</strong>
</span>
</h4>
</div>
</div>
@if (ViewBag.Authorized)
{
<div class="text-center text-sm-right col-lg-4 col-12 mt-2">
<div id="profile_aliases_btn" class="oi oi-caret-bottom h3 ml-0 ml-md-2"></div>
<div class="col-12 col-lg-2 pr-lg-0 text-center text-lg-right">
@if (Model.LevelInt != -1)
{
<div id="profile_action_edit_btn" class="profile-action oi oi-cog text-muted h3 ml-2" title="Client Options" data-action="edit" aria-hidden="true"></div>
@ -45,31 +78,10 @@
<div id="profile_action_unban_btn" class="profile-action oi oi-lock-locked text-danger h3 ml-2" title="Unban Client" data-action="unban" aria-hidden="true"></div>
}
}
<div id="profile_aliases" class="text-muted">
@{
foreach (var linked in Model.LinkedAccounts)
{
@Html.ActionLink(linked.Value.ToString("X"), "ProfileAsync", "Client", new { id = linked.Key }, new { @class = "link-inverse" })<br />
}
foreach (string alias in Model.Aliases)
{
@alias<br />
}
if (ViewBag.Authorized)
{
foreach (string ip in Model.IPs)
{
<a class="ip-locate-link" href="#" data-ip="@ip">@ip</a><br />
}
}
}
</div>
</div>
}
</div>
@*<div id="profile_info" class="text-center text-md-left pr-md-3 pl-md-3">
<div id="profile_time_played" class="text-muted">

View File

@ -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; }

View File

@ -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;
}