Fix small issue with query optimization missing a FK set

Fix accidentally rename of controller method
This commit is contained in:
RaidMax 2019-11-18 08:08:09 -06:00
parent 161b27e2f2
commit d1886fdd20
7 changed files with 23 additions and 13 deletions

View File

@ -42,6 +42,12 @@
<StartupObject /> <StartupObject />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
<ErrorReport>none</ErrorReport>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj"> <ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj">
<Private>true</Private> <Private>true</Private>

View File

@ -116,26 +116,26 @@ namespace IW4MAdmin.Application
// this happens if a plugin requires login // this happens if a plugin requires login
catch (AuthorizationException ex) catch (AuthorizationException ex)
{ {
newEvent.FailReason = GameEvent.EventFailReason.Permission; newEvent.FailReason = EventFailReason.Permission;
newEvent.Origin.Tell($"{Utilities.CurrentLocalization.LocalizationIndex["COMMAND_NOTAUTHORIZED"]} - {ex.Message}"); newEvent.Origin.Tell($"{Utilities.CurrentLocalization.LocalizationIndex["COMMAND_NOTAUTHORIZED"]} - {ex.Message}");
} }
catch (NetworkException ex) catch (NetworkException ex)
{ {
newEvent.FailReason = GameEvent.EventFailReason.Exception; newEvent.FailReason = EventFailReason.Exception;
Logger.WriteError(ex.Message); Logger.WriteError(ex.Message);
Logger.WriteDebug(ex.GetExceptionInfo()); Logger.WriteDebug(ex.GetExceptionInfo());
} }
catch (ServerException ex) catch (ServerException ex)
{ {
newEvent.FailReason = GameEvent.EventFailReason.Exception; newEvent.FailReason = EventFailReason.Exception;
Logger.WriteWarning(ex.Message); Logger.WriteWarning(ex.Message);
} }
catch (Exception ex) catch (Exception ex)
{ {
newEvent.FailReason = GameEvent.EventFailReason.Exception; newEvent.FailReason = EventFailReason.Exception;
Logger.WriteError(Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_EXCEPTION"].FormatExt(newEvent.Owner)); Logger.WriteError(Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_EXCEPTION"].FormatExt(newEvent.Owner));
Logger.WriteDebug(ex.GetExceptionInfo()); Logger.WriteDebug(ex.GetExceptionInfo());
} }

View File

@ -76,11 +76,11 @@ namespace IW4MAdmin.Application.IO
#if DEBUG #if DEBUG
_server.Logger.WriteVerbose(gameEvent.Data); _server.Logger.WriteVerbose(gameEvent.Data);
#endif #endif
gameEvent.Owner = _server;
// we don't want to add the event if ignoreBots is on and the event comes from a bot // we don't want to add the event if ignoreBots is on and the event comes from a bot
if (!_ignoreBots || (_ignoreBots && !((gameEvent.Origin?.IsBot ?? false) || (gameEvent.Target?.IsBot ?? false)))) if (!_ignoreBots || (_ignoreBots && !((gameEvent.Origin?.IsBot ?? false) || (gameEvent.Target?.IsBot ?? false))))
{ {
gameEvent.Owner = _server;
if ((gameEvent.RequiredEntity & GameEvent.EventRequiredEntity.Origin) == GameEvent.EventRequiredEntity.Origin && gameEvent.Origin.NetworkId != 1) if ((gameEvent.RequiredEntity & GameEvent.EventRequiredEntity.Origin) == GameEvent.EventRequiredEntity.Origin && gameEvent.Origin.NetworkId != 1)
{ {
gameEvent.Origin = _server.GetClientsAsList().First(_client => _client.NetworkId == gameEvent.Origin?.NetworkId); gameEvent.Origin = _server.GetClientsAsList().First(_client => _client.NetworkId == gameEvent.Origin?.NetworkId);

View File

@ -103,7 +103,7 @@ namespace SharedLibraryCore.Database.Models
} }
[NotMapped] [NotMapped]
public string CleanedName => Name.StripColors(); public string CleanedName => Name?.StripColors();
[NotMapped] [NotMapped]
public virtual int? IPAddress public virtual int? IPAddress
@ -463,8 +463,7 @@ namespace SharedLibraryCore.Database.Models
{ {
var loc = Utilities.CurrentLocalization.LocalizationIndex; var loc = Utilities.CurrentLocalization.LocalizationIndex;
string strippedName = Name.StripColors(); if (string.IsNullOrWhiteSpace(Name) || CleanedName.Replace(" ", "").Length < 3)
if (string.IsNullOrWhiteSpace(Name) || strippedName.Replace(" ", "").Length < 3)
{ {
CurrentServer.Logger.WriteDebug($"Kicking {this} because their name is too short"); CurrentServer.Logger.WriteDebug($"Kicking {this} because their name is too short");
Kick(loc["SERVER_KICK_MINNAME"], Utilities.IW4MAdminClient(CurrentServer)); Kick(loc["SERVER_KICK_MINNAME"], Utilities.IW4MAdminClient(CurrentServer));
@ -575,7 +574,6 @@ namespace SharedLibraryCore.Database.Models
// we want to get any penalties that are tied to their IP or AliasLink (but not necessarily their GUID) // we want to get any penalties that are tied to their IP or AliasLink (but not necessarily their GUID)
var activePenalties = await CurrentServer.Manager.GetPenaltyService().GetActivePenaltiesAsync(AliasLinkId, ipAddress); var activePenalties = await CurrentServer.Manager.GetPenaltyService().GetActivePenaltiesAsync(AliasLinkId, ipAddress);
var banPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.Ban); var banPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.Ban);
var tempbanPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.TempBan); var tempbanPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.TempBan);
var flagPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.Flag); var flagPenalty = activePenalties.FirstOrDefault(_penalty => _penalty.Type == EFPenalty.PenaltyType.Flag);

View File

@ -340,6 +340,7 @@ namespace SharedLibraryCore.Services
client.AliasLink = new EFAliasLink() client.AliasLink = new EFAliasLink()
{ {
AliasLinkId = client.AliasLinkId,
Children = await context.Aliases Children = await context.Aliases
.Where(_alias => _alias.LinkId == client.AliasLinkId) .Where(_alias => _alias.LinkId == client.AliasLinkId)
.Select(_alias => new EFAlias() .Select(_alias => new EFAlias()

View File

@ -21,6 +21,11 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Migrations\20181126232438_AddEndpointToEFServer.cs" /> <Compile Remove="Migrations\20181126232438_AddEndpointToEFServer.cs" />
<Compile Remove="Migrations\20181126233300_AddEndpointToEFServer.cs" /> <Compile Remove="Migrations\20181126233300_AddEndpointToEFServer.cs" />

View File

@ -152,7 +152,7 @@ namespace WebfrontCore.Controllers
return View("Find/Index", clientsDto); return View("Find/Index", clientsDto);
} }
public async Task<IActionResult> GetMeta(int id, int count, int offset, DateTime? startAt) public async Task<IActionResult> Meta(int id, int count, int offset, DateTime? startAt)
{ {
IEnumerable<ProfileMeta> meta = await MetaService.GetRuntimeMeta(id, startAt == null ? offset : 0, count, startAt ?? DateTime.UtcNow); IEnumerable<ProfileMeta> meta = await MetaService.GetRuntimeMeta(id, startAt == null ? offset : 0, count, startAt ?? DateTime.UtcNow);