mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
# Description Cleaned up Logger obsolete compiler warnings in non robust code. Should probably be changed to a ISawmill reference in classes to avoid repeated lookups in heavy logging logic. --- # Changelog 🆑 - tweak: Logger to Logger.GetSawmill("name"); --------- Co-authored-by: ilmenwe <no@mail.com> (cherry picked from commit 2e8ffd971716d38dc6d5a520bebdf88b743045a3)
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Content.Server.EUI;
|
|
using Content.Shared.Administration.Notes;
|
|
using Content.Shared.CCVar;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Eui;
|
|
using Robust.Shared.Configuration;
|
|
|
|
namespace Content.Server.Administration.Notes;
|
|
|
|
public sealed class UserNotesEui : BaseEui
|
|
{
|
|
[Dependency] private readonly IAdminNotesManager _notesMan = default!;
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
private readonly bool _seeOwnNotes;
|
|
|
|
public UserNotesEui()
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
_seeOwnNotes = _cfg.GetCVar(CCVars.SeeOwnNotes);
|
|
|
|
if (!_seeOwnNotes)
|
|
{
|
|
Logger.GetSawmill("admin.notes").Warning("User notes initialized when see_own_notes set to false");
|
|
}
|
|
}
|
|
|
|
private Dictionary<(int, NoteType), SharedAdminNote> Notes { get; set; } = new();
|
|
|
|
public override EuiStateBase GetNewState()
|
|
{
|
|
return new UserNotesEuiState(
|
|
Notes
|
|
);
|
|
}
|
|
|
|
public async Task UpdateNotes()
|
|
{
|
|
if (!_seeOwnNotes)
|
|
{
|
|
Logger.GetSawmill("admin.notes").Warning($"User {Player.Name} with ID {Player.UserId} tried to update their own user notes when see_own_notes was set to false");
|
|
return;
|
|
}
|
|
|
|
Notes = (await _notesMan.GetVisibleRemarks(Player.UserId)).Select(note => note.ToShared()).ToDictionary(note => (note.Id, note.NoteType));
|
|
StateDirty();
|
|
}
|
|
}
|