fix issue with detecting bans on accounts with new ips when implicit linking is disabled

This commit is contained in:
RaidMax 2021-10-20 11:16:35 -05:00
parent e4153e0c2f
commit 8f52714fb7
2 changed files with 21 additions and 11 deletions

View File

@ -162,15 +162,29 @@ namespace SharedLibraryCore.Services
.Where(p => p.LinkId == linkId) .Where(p => p.LinkId == linkId)
.Where(filter); .Where(filter);
var iqIpPenalties = _appConfig.EnableImplicitAccountLinking IQueryable<EFPenalty> iqIpPenalties;
? context.Aliases
if (_appConfig.EnableImplicitAccountLinking)
{
iqIpPenalties = context.Aliases
.Where(a => a.IPAddress != null && a.IPAddress == ip) .Where(a => a.IPAddress != null && a.IPAddress == ip)
.SelectMany(a => a.Link.ReceivedPenalties) .SelectMany(a => a.Link.ReceivedPenalties)
.Where(filter)
: context.Penalties.Where(penalty =>
penalty.Offender.CurrentAlias.IPAddress != null &&
penalty.Offender.CurrentAlias.IPAddress == ip)
.Where(filter); .Where(filter);
}
else
{
var aliasIps = await context.Aliases.Where(alias => alias.LinkId == linkId && alias.IPAddress != null)
.Select(alias => alias.IPAddress)
.ToListAsync();
if (ip != null)
{
aliasIps.Add(ip);
}
iqIpPenalties = context.Penalties
.Where(penalty => aliasIps.Contains(penalty.Offender.CurrentAlias.IPAddress))
.Where(filter);
}
var activePenalties = (await iqLinkPenalties.ToListAsync()) var activePenalties = (await iqLinkPenalties.ToListAsync())
.Union(await iqIpPenalties.ToListAsync()) .Union(await iqIpPenalties.ToListAsync())

View File

@ -78,10 +78,6 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Remove="Views\Plugins\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Remove="Views\Plugins\**" /> <EmbeddedResource Remove="Views\Plugins\**" />
</ItemGroup> </ItemGroup>
@ -96,7 +92,7 @@
<Exec Command="if $(ConfigurationName) == Debug ( &#xD;&#xA;powershell -Command wget https://raw.githubusercontent.com/iconic/open-iconic/master/font/css/open-iconic-bootstrap.scss -o $(ProjectDir)wwwroot\lib\open-iconic\font\css\open-iconic-bootstrap.scss&#xD;&#xA;echo d | xcopy /f /y $(ProjectDir)wwwroot\lib\open-iconic\font\fonts $(ProjectDir)wwwroot\font\&#xD;&#xA;)" /> <Exec Command="if $(ConfigurationName) == Debug ( &#xD;&#xA;powershell -Command wget https://raw.githubusercontent.com/iconic/open-iconic/master/font/css/open-iconic-bootstrap.scss -o $(ProjectDir)wwwroot\lib\open-iconic\font\css\open-iconic-bootstrap.scss&#xD;&#xA;echo d | xcopy /f /y $(ProjectDir)wwwroot\lib\open-iconic\font\fonts $(ProjectDir)wwwroot\font\&#xD;&#xA;)" />
</Target> </Target>
<Target Name="MyPreCompileTarget" BeforeTargets="Build"> <Target Name="MyPreCompileTarget" BeforeTargets="Build" Condition="'$(Configuration)'!='Debug'">
<Exec Command="dotnet bundle" /> <Exec Command="dotnet bundle" />
</Target> </Target>
</Project> </Project>