mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
fix: issue with group selection selecting users with partial name of group users
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package tui
|
package tui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -76,11 +75,13 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
delete(selected, string(sel))
|
delete(selected, string(sel))
|
||||||
}
|
}
|
||||||
users := utils.Groups[group]
|
users := utils.Groups[group]
|
||||||
|
//TODO: this may be able to be done in a more efficient way currently this would scale poorly
|
||||||
for k, v := range dupProtect {
|
for k, v := range dupProtect {
|
||||||
if _, ok := selected[k]; !ok {
|
if _, ok := selected[k]; !ok {
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
if strings.Contains(user.Names, v) {
|
split := strings.Split(user.Names, "/")
|
||||||
selected[k] = item(k)
|
if split[0] == v || split[1] == v {
|
||||||
|
selectToggle(item(k))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,18 +145,3 @@ func (m *mainModel) Next() {
|
|||||||
m.index++
|
m.index++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Entry_GR() string {
|
|
||||||
p := tea.NewProgram(newModel())
|
|
||||||
|
|
||||||
m, err := p.Run()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if m.(mainModel).currentFocusedModel() != "" {
|
|
||||||
// returns the group name
|
|
||||||
return strings.Split(m.(mainModel).currentFocusedModel(), ":")[0]
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user