Fixed a bug where it was possible to add the same user multiple times in

the user signals
This commit is contained in:
2025-01-26 18:50:49 +02:00
parent a39fa91fe0
commit eab0af859c

View File

@@ -167,16 +167,16 @@ func (m *Model) Select() (tea.Cmd, int) {
id := snowflake.ID(num)
assert.NoError(err, "input is already validated to be valid")
i := -1
index := -1
for i, peer := range state.Data.Peers {
if peer == id {
i = i
index = i
break
}
}
if i != -1 {
return nil, i
if index != -1 {
return nil, index
}
state.Data.Peers = slices.Insert(state.Data.Peers, 0, id)