Use sorted username dropdown for character owner editing
This commit is contained in:
@@ -89,6 +89,20 @@ public partial class Workspace : IAsyncDisposable
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadKnownUsernamesAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var usernames = await ApiClient.RequestAsync<IReadOnlyList<string>>("GET", "/api/users/usernames");
|
||||
KnownUsernames = usernames.OrderBy(username => username, StringComparer.OrdinalIgnoreCase).ToList();
|
||||
}
|
||||
catch (ApiRequestException ex)
|
||||
{
|
||||
KnownUsernames = [];
|
||||
SetStatus(ex.Message, true);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> ReloadAuthenticatedSessionAsync(Guid? preferredCampaignId)
|
||||
{
|
||||
var me = await TryGetMeAsync();
|
||||
@@ -291,8 +305,11 @@ public partial class Workspace : IAsyncDisposable
|
||||
ShowCreateCharacterModal = true;
|
||||
}
|
||||
|
||||
private void OpenEditCharacterModal(CharacterSummary character)
|
||||
private async Task OpenEditCharacterModal(CharacterSummary character)
|
||||
{
|
||||
if (IsCurrentUserGm)
|
||||
await LoadKnownUsernamesAsync();
|
||||
|
||||
EditingCharacterId = character.Id;
|
||||
EditCharacterInitialModel = new()
|
||||
{
|
||||
@@ -659,6 +676,7 @@ public partial class Workspace : IAsyncDisposable
|
||||
CampaignLog = [];
|
||||
SelectedCharacterId = null;
|
||||
LastRoll = null;
|
||||
KnownUsernames = [];
|
||||
ShowCreateCharacterModal = false;
|
||||
ShowEditCharacterModal = false;
|
||||
CanEditCharacterOwner = false;
|
||||
@@ -723,6 +741,7 @@ public partial class Workspace : IAsyncDisposable
|
||||
private List<RulesetDefinition> Rulesets { get; set; } = [];
|
||||
private Guid? SelectedCharacterId { get; set; }
|
||||
private RollResult? LastRoll { get; set; }
|
||||
private List<string> KnownUsernames { get; set; } = [];
|
||||
private string RollVisibility { get; set; } = "public";
|
||||
|
||||
private bool IsMutating { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user