Show ban and note count in ahelp window (#15328)
This commit is contained in:
@@ -330,6 +330,22 @@ namespace Content.Server.Database
|
||||
ImmutableArray<byte>? hwId,
|
||||
bool includeUnbanned);
|
||||
|
||||
/// <summary>
|
||||
/// Counts an user's bans.
|
||||
/// This will return pardoned bans as well.
|
||||
/// One of <see cref="address"/> or <see cref="userId"/> need to not be null.
|
||||
/// </summary>
|
||||
/// <param name="address">The ip address of the user.</param>
|
||||
/// <param name="userId">The id of the user.</param>
|
||||
/// <param name="hwId">The HWId of the user.</param>
|
||||
/// <param name="includeUnbanned">Include pardoned and expired bans.</param>
|
||||
/// <returns>The user's ban history.</returns>
|
||||
public abstract Task<int> CountServerBansAsync(
|
||||
IPAddress? address,
|
||||
NetUserId? userId,
|
||||
ImmutableArray<byte>? hwId,
|
||||
bool includeUnbanned);
|
||||
|
||||
public abstract Task AddServerBanAsync(ServerBanDef serverBan);
|
||||
public abstract Task AddServerUnbanAsync(ServerUnbanDef serverUnban);
|
||||
|
||||
@@ -996,6 +1012,19 @@ namespace Content.Server.Database
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<int> CountAdminNotes(Guid player)
|
||||
{
|
||||
await using var db = await GetDb();
|
||||
return await db.DbContext.AdminNotes
|
||||
.Where(note => note.PlayerUserId == player)
|
||||
.Where(note => !note.Deleted)
|
||||
.Include(note => note.Round)
|
||||
.Include(note => note.CreatedBy)
|
||||
.Include(note => note.LastEditedBy)
|
||||
.Include(note => note.Player)
|
||||
.CountAsync();
|
||||
}
|
||||
|
||||
public async Task DeleteAdminNote(int id, Guid deletedBy, DateTime deletedAt)
|
||||
{
|
||||
await using var db = await GetDb();
|
||||
|
||||
Reference in New Issue
Block a user