Fix - Enforcing Unique groupe aliases
This commit is contained in:
@@ -40,6 +40,7 @@ internal sealed class GroupPanel
|
|||||||
private string _editGroupComment = string.Empty;
|
private string _editGroupComment = string.Empty;
|
||||||
private string _editGroupEntry = string.Empty;
|
private string _editGroupEntry = string.Empty;
|
||||||
private bool _errorGroupCreate = false;
|
private bool _errorGroupCreate = false;
|
||||||
|
private string _errorGroupCreateMessage = string.Empty;
|
||||||
private bool _errorGroupJoin;
|
private bool _errorGroupJoin;
|
||||||
private bool _isPasswordValid;
|
private bool _isPasswordValid;
|
||||||
private GroupPasswordDto? _lastCreatedGroup = null;
|
private GroupPasswordDto? _lastCreatedGroup = null;
|
||||||
@@ -110,6 +111,7 @@ internal sealed class GroupPanel
|
|||||||
_lastCreatedGroup = null;
|
_lastCreatedGroup = null;
|
||||||
_errorGroupCreate = false;
|
_errorGroupCreate = false;
|
||||||
_newSyncShellAlias = string.Empty;
|
_newSyncShellAlias = string.Empty;
|
||||||
|
_errorGroupCreateMessage = string.Empty;
|
||||||
_showModalCreateGroup = true;
|
_showModalCreateGroup = true;
|
||||||
ImGui.OpenPopup("Create Syncshell");
|
ImGui.OpenPopup("Create Syncshell");
|
||||||
}
|
}
|
||||||
@@ -168,10 +170,11 @@ internal sealed class GroupPanel
|
|||||||
_newSyncShellAlias = string.Empty;
|
_newSyncShellAlias = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_lastCreatedGroup = null;
|
_lastCreatedGroup = null;
|
||||||
_errorGroupCreate = true;
|
_errorGroupCreate = true;
|
||||||
|
_errorGroupCreateMessage = ex.Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,6 +182,7 @@ internal sealed class GroupPanel
|
|||||||
{
|
{
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
_errorGroupCreate = false;
|
_errorGroupCreate = false;
|
||||||
|
_errorGroupCreateMessage = string.Empty;
|
||||||
if (!string.IsNullOrWhiteSpace(_lastCreatedGroup.Group.Alias))
|
if (!string.IsNullOrWhiteSpace(_lastCreatedGroup.Group.Alias))
|
||||||
{
|
{
|
||||||
ImGui.TextUnformatted("Syncshell Name: " + _lastCreatedGroup.Group.Alias);
|
ImGui.TextUnformatted("Syncshell Name: " + _lastCreatedGroup.Group.Alias);
|
||||||
@@ -196,8 +200,10 @@ internal sealed class GroupPanel
|
|||||||
|
|
||||||
if (_errorGroupCreate)
|
if (_errorGroupCreate)
|
||||||
{
|
{
|
||||||
UiSharedService.ColorTextWrapped("You are already owner of the maximum amount of Syncshells (3) or joined the maximum amount of Syncshells (6). Relinquish ownership of your own Syncshells to someone else or leave existing Syncshells.",
|
var msg = string.IsNullOrWhiteSpace(_errorGroupCreateMessage)
|
||||||
new Vector4(1, 0, 0, 1));
|
? "You are already owner of the maximum amount of Syncshells (3) or joined the maximum amount of Syncshells (6). Relinquish ownership of your own Syncshells to someone else or leave existing Syncshells."
|
||||||
|
: _errorGroupCreateMessage;
|
||||||
|
UiSharedService.ColorTextWrapped(msg, new Vector4(1, 0, 0, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
UiSharedService.SetScaledWindowSize(350);
|
UiSharedService.SetScaledWindowSize(350);
|
||||||
|
|||||||
@@ -49,7 +49,12 @@ public partial class ApiController
|
|||||||
await _mareHub!.SendAsync(nameof(GroupClear), group).ConfigureAwait(false);
|
await _mareHub!.SendAsync(nameof(GroupClear), group).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GroupPasswordDto> GroupCreate(string? alias = null)
|
public Task<GroupPasswordDto> GroupCreate()
|
||||||
|
{
|
||||||
|
return GroupCreate(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<GroupPasswordDto> GroupCreate(string? alias)
|
||||||
{
|
{
|
||||||
CheckConnection();
|
CheckConnection();
|
||||||
return await _mareHub!.InvokeAsync<GroupPasswordDto>(nameof(GroupCreate), string.IsNullOrWhiteSpace(alias) ? null : alias.Trim()).ConfigureAwait(false);
|
return await _mareHub!.InvokeAsync<GroupPasswordDto>(nameof(GroupCreate), string.IsNullOrWhiteSpace(alias) ? null : alias.Trim()).ConfigureAwait(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user