public async Task ModifyNote(int noteId, IPlayerSession editedBy, string message) { message = message.Trim(); var note = await _db.GetAdminNote(noteId); if (note == null || note.Message == message) { return; } _sawmill.Info($"Player {editedBy.Name} modified note {noteId} with message {message}"); var editedAt = DateTime.UtcNow; await _db.EditAdminNote(noteId, message, editedBy.UserId, editedAt); var sharedNote = new SharedAdminNote( noteId, note.RoundId, message, note.CreatedBy.LastSeenUserName, editedBy.Name, note.CreatedAt, note.LastEditedAt ); NoteModified?.Invoke(sharedNote); }
public AdminNotesLine(SharedAdminNote note) { RobustXamlLoader.Load(this); Note = note; MouseFilter = MouseFilterMode.Pass; AddLabel(); }
public void UpdateNote(SharedAdminNote note) { Note = note; _label?.SetMessage(note.Message); if (_edit != null && _edit.Text != note.Message) { _edit.Text = note.Message; } }
public async Task AddNote(IPlayerSession createdBy, Guid player, string message) { _sawmill.Info($"Player {createdBy.Name} added note with message {message}"); _systems.TryGetEntitySystem(out GameTicker? ticker); int?round = ticker == null || ticker.RoundId == 0 ? null : ticker.RoundId; var createdAt = DateTime.UtcNow; var noteId = await _db.AddAdminNote(round, player, message, createdBy.UserId, createdAt); var note = new SharedAdminNote( noteId, round, message, createdBy.Name, createdBy.Name, createdAt, createdAt ); NoteAdded?.Invoke(note); }
public AdminNotesLinePopup(SharedAdminNote note, bool showDelete, bool showEdit) { RobustXamlLoader.Load(this); NoteId = note.Id; DeleteButton.Visible = showDelete; EditButton.Visible = showEdit; UserInterfaceManager.ModalRoot.AddChild(this); IdLabel.Text = Loc.GetString("admin-notes-id", ("id", note.Id)); RoundIdLabel.Text = note.Round == null ? Loc.GetString("admin-notes-round-id-unknown") : Loc.GetString("admin-notes-round-id", ("id", note.Round)); CreatedByLabel.Text = Loc.GetString("admin-notes-created-by", ("author", note.CreatedByName)); CreatedAtLabel.Text = Loc.GetString("admin-notes-created-at", ("date", note.CreatedAt.ToString("dd MMM yyyy HH:mm:ss"))); EditedByLabel.Text = Loc.GetString("admin-notes-last-edited-by", ("author", note.EditedByName)); EditedAtLabel.Text = Loc.GetString("admin-notes-last-edited-at", ("date", note.LastEditedAt.ToString("dd MMM yyyy HH:mm:ss"))); EditButton.OnPressed += EditPressed; DeleteButton.OnPressed += DeletePressed; }