Skip to content

Commit

Permalink
small tweaks for notes/tags
Browse files Browse the repository at this point in the history
  • Loading branch information
RaidMax committed Jul 20, 2022
1 parent f4078a1 commit 2255234
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Application/Commands/AddClientNoteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public AddClientNoteCommand(CommandConfiguration config, ITranslationLookup layo
new CommandArgument
{
Name = _translationLookup["COMMANDS_ARGS_NOTE"],
Required = true
Required = false
}
};

Expand Down
6 changes: 3 additions & 3 deletions WebfrontCore/Controllers/ActionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -598,20 +598,20 @@ public async Task<IActionResult> OfflineMessage(int targetId, string message)
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)
Expand Down
5 changes: 2 additions & 3 deletions WebfrontCore/Controllers/Client/ClientController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public async Task<IActionResult> Profile(int id, MetaType? metaFilterType, Cance
_metaService.GetPersistentMetaByLookup(EFMeta.ClientTagV2, EFMeta.ClientTagNameV2, client.ClientId,
token),
_metaService.GetPersistentMeta("GravatarEmail", client.ClientId, token),

};

var persistentMeta = await Task.WhenAll(persistentMetaTask);
Expand All @@ -71,7 +70,7 @@ public async Task<IActionResult> Profile(int id, MetaType? metaFilterType, Cance
client.SetAdditionalProperty(EFMeta.ClientTagV2, tag.Value);
}

if (note is not null)
if (!string.IsNullOrWhiteSpace(note?.Note))
{
note.OriginEntityName = await _clientService.GetClientNameById(note.OriginEntityId);
}
Expand Down Expand Up @@ -135,7 +134,7 @@ public async Task<IActionResult> Profile(int id, MetaType? metaFilterType, Cance
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
Expand Down
4 changes: 3 additions & 1 deletion WebfrontCore/Views/Client/Profile/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 2255234

Please sign in to comment.