small tweaks for notes/tags

This commit is contained in:
RaidMax 2022-07-20 11:39:46 -05:00
parent d2cfd50e39
commit 507688a175
4 changed files with 9 additions and 8 deletions

View File

@ -31,7 +31,7 @@ public class AddClientNoteCommand : Command
new CommandArgument
{
Name = _translationLookup["COMMANDS_ARGS_NOTE"],
Required = true
Required = false
}
};

View File

@ -598,20 +598,20 @@ namespace WebfrontCore.Controllers
public async Task<IActionResult> SetClientTagForm(int id, CancellationToken token)
{
var tags = await _metaService.GetPersistentMetaValue<List<LookupValue<string>>>(EFMeta.ClientTagNameV2,
token);
token) ?? new List<LookupValue<string>>();
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<InputInfo>
{
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)

View File

@ -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<InformationResponse>(new ClientPaginationRequest

View File

@ -184,7 +184,9 @@
<div class="text-force-break">@line.TrimEnd('\r')</div>
}
<div class="mt-5">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.NoteMeta.OriginEntityId" class="no-decoration ">@Model.NoteMeta.OriginEntityName</a>
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.NoteMeta.OriginEntityId" class="no-decoration ">
<color-code value="@Model.NoteMeta.OriginEntityName"></color-code>
</a>
<span>&mdash; @Model.NoteMeta.ModifiedDate.HumanizeForCurrentCulture()</span>
</div>
</div>