Change admin log filter types and impacts to use hashsets

This commit is contained in:
DrSmugleaf
2021-12-24 20:48:21 +01:00
parent ae287f264a
commit 2f75b282b9
5 changed files with 10 additions and 11 deletions

View File

@@ -48,7 +48,7 @@ public class AdminLogsEui : BaseEui
{ {
var request = new LogsRequest( var request = new LogsRequest(
LogsControl.SelectedRoundId, LogsControl.SelectedRoundId,
LogsControl.SelectedTypes.ToList(), LogsControl.SelectedTypes.ToHashSet(),
null, null,
null, null,
null, null,

View File

@@ -122,7 +122,7 @@ public class AddTests : ContentIntegrationTest
{ {
Round = log.RoundId, Round = log.RoundId,
Search = log.Message, Search = log.Message,
Types = new List<LogType> {log.Type}, Types = new HashSet<LogType> {log.Type},
}; };
await foreach (var json in sDatabase.GetAdminLogsJson(filter)) await foreach (var json in sDatabase.GetAdminLogsJson(filter))
@@ -295,7 +295,7 @@ public class AddTests : ContentIntegrationTest
{ {
Round = log.RoundId, Round = log.RoundId,
Search = log.Message, Search = log.Message,
Types = new List<LogType> {log.Type}, Types = new HashSet<LogType> {log.Type},
}; };
await foreach (var json in sDatabase.GetAdminLogsJson(filter)) await foreach (var json in sDatabase.GetAdminLogsJson(filter))

View File

@@ -4,7 +4,6 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.GameTicking; using Content.Server.GameTicking;
using Content.Shared.Administration.Logs;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Database; using Content.Shared.Database;
using NUnit.Framework; using NUnit.Framework;
@@ -53,7 +52,7 @@ public class QueryTests : ContentIntegrationTest
{ {
Round = sGamerTicker.RoundId, Round = sGamerTicker.RoundId,
Search = guid.ToString(), Search = guid.ToString(),
Types = new List<LogType> {LogType.Unknown}, Types = new HashSet<LogType> {LogType.Unknown},
After = date, After = date,
AnyPlayers = new[] {player.UserId.UserId} AnyPlayers = new[] {player.UserId.UserId}
}; };

View File

@@ -14,9 +14,9 @@ public sealed class LogFilter
public string? Search { get; set; } public string? Search { get; set; }
public List<LogType>? Types { get; set; } public HashSet<LogType>? Types { get; set; }
public List<LogImpact>? Impacts { get; set; } public HashSet<LogImpact>? Impacts { get; set; }
public DateTime? Before { get; set; } public DateTime? Before { get; set; }

View File

@@ -48,8 +48,8 @@ public static class AdminLogsEuiMsg
{ {
public LogsRequest( public LogsRequest(
int? roundId, int? roundId,
List<LogType>? types, HashSet<LogType>? types,
List<LogImpact>? impacts, HashSet<LogImpact>? impacts,
DateTime? before, DateTime? before,
DateTime? after, DateTime? after,
Guid[]? anyPlayers, Guid[]? anyPlayers,
@@ -69,8 +69,8 @@ public static class AdminLogsEuiMsg
} }
public int? RoundId { get; set; } public int? RoundId { get; set; }
public List<LogType>? Types { get; set; } public HashSet<LogType>? Types { get; set; }
public List<LogImpact>? Impacts { get; set; } public HashSet<LogImpact>? Impacts { get; set; }
public DateTime? Before { get; set; } public DateTime? Before { get; set; }
public DateTime? After { get; set; } public DateTime? After { get; set; }
public Guid[]? AnyPlayers { get; set; } public Guid[]? AnyPlayers { get; set; }