From 2255234229358554da41fd3f8440e43ae685161f Mon Sep 17 00:00:00 2001 From: RaidMax Date: Wed, 20 Jul 2022 11:39:46 -0500 Subject: [PATCH] small tweaks for notes/tags --- Application/Commands/AddClientNoteCommand.cs | 2 +- WebfrontCore/Controllers/ActionController.cs | 6 +++--- WebfrontCore/Controllers/Client/ClientController.cs | 5 ++--- WebfrontCore/Views/Client/Profile/Index.cshtml | 4 +++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Application/Commands/AddClientNoteCommand.cs b/Application/Commands/AddClientNoteCommand.cs index 7636b677..06f380f8 100644 --- a/Application/Commands/AddClientNoteCommand.cs +++ b/Application/Commands/AddClientNoteCommand.cs @@ -31,7 +31,7 @@ public class AddClientNoteCommand : Command new CommandArgument { Name = _translationLookup["COMMANDS_ARGS_NOTE"], - Required = true + Required = false } }; diff --git a/WebfrontCore/Controllers/ActionController.cs b/WebfrontCore/Controllers/ActionController.cs index 27764c0e..aef08fae 100644 --- a/WebfrontCore/Controllers/ActionController.cs +++ b/WebfrontCore/Controllers/ActionController.cs @@ -598,20 +598,20 @@ namespace WebfrontCore.Controllers public async Task SetClientTagForm(int id, CancellationToken token) { var tags = await _metaService.GetPersistentMetaValue>>(EFMeta.ClientTagNameV2, - token); + token) ?? new List>(); var existingTag = await _metaService.GetPersistentMetaByLookup(EFMeta.ClientTagV2, EFMeta.ClientTagNameV2, id, Manager.CancellationToken); var info = new ActionInfo { ActionButtonLabel = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_SUBMIT"], - Name = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_TITLE"], + Name = Localization["WEBFRONT_PROFILE_CONTEXT_MENU_TAG"], Inputs = new List { new() { Name = "clientTag", Type = "select", - Label = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_TITLE"], + Label = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_FORM_TAG"], Values = tags.ToDictionary( item => item.Value == existingTag?.Value ? $"!selected!{item.Value}" : item.Value, item => item.Value) diff --git a/WebfrontCore/Controllers/Client/ClientController.cs b/WebfrontCore/Controllers/Client/ClientController.cs index 445c10f6..ee01dfe2 100644 --- a/WebfrontCore/Controllers/Client/ClientController.cs +++ b/WebfrontCore/Controllers/Client/ClientController.cs @@ -57,7 +57,6 @@ namespace WebfrontCore.Controllers _metaService.GetPersistentMetaByLookup(EFMeta.ClientTagV2, EFMeta.ClientTagNameV2, client.ClientId, token), _metaService.GetPersistentMeta("GravatarEmail", client.ClientId, token), - }; var persistentMeta = await Task.WhenAll(persistentMetaTask); @@ -71,7 +70,7 @@ namespace WebfrontCore.Controllers client.SetAdditionalProperty(EFMeta.ClientTagV2, tag.Value); } - if (note is not null) + if (!string.IsNullOrWhiteSpace(note?.Note)) { note.OriginEntityName = await _clientService.GetClientNameById(note.OriginEntityId); } @@ -135,7 +134,7 @@ namespace WebfrontCore.Controllers ingameClient.CurrentServer.Port), CurrentServerName = ingameClient?.CurrentServer?.Hostname, GeoLocationInfo = await _geoLocationService.Locate(client.IPAddressString), - NoteMeta = note + NoteMeta = string.IsNullOrWhiteSpace(note?.Note) ? null: note }; var meta = await _metaService.GetRuntimeMeta(new ClientPaginationRequest diff --git a/WebfrontCore/Views/Client/Profile/Index.cshtml b/WebfrontCore/Views/Client/Profile/Index.cshtml index 55846bc4..2b006914 100644 --- a/WebfrontCore/Views/Client/Profile/Index.cshtml +++ b/WebfrontCore/Views/Client/Profile/Index.cshtml @@ -184,7 +184,9 @@
@line.TrimEnd('\r')
}
- @Model.NoteMeta.OriginEntityName + + + — @Model.NoteMeta.ModifiedDate.HumanizeForCurrentCulture()