Fix search being case sensitive for admin logs from uncached db rounds (#19066)

* Fix search being case sensitive for admin logs from uncached db rounds

* Fix text search query for sqlite
This commit is contained in:
DrSmugleaf
2023-08-14 17:27:25 -07:00
committed by GitHub
parent b33aad7a01
commit 71f5e38faf
3 changed files with 31 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Content.Server.Administration.Logs;
using Content.Server.IP;
using Content.Server.Preferences.Managers;
using Content.Shared.CCVar;
@@ -478,6 +479,15 @@ namespace Content.Server.Database
return round.Id;
}
protected override IQueryable<AdminLog> StartAdminLogsQuery(ServerDbContext db, LogFilter? filter = null)
{
IQueryable<AdminLog> query = db.AdminLog;
if (filter?.Search != null)
query = query.Where(log => EF.Functions.Like(log.Message, $"%{filter.Search}%"));
return query;
}
public override async Task<int> AddAdminNote(AdminNote note)
{
await using (var db = await GetDb())