summaryrefslogtreecommitdiff
path: root/helpfuncs.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-12-03 13:29:57 +0300
committerGrail Finder <wohilas@gmail.com>2025-12-03 13:29:57 +0300
commitcec10210c284a17cd341b48ee205bcfd278205bd (patch)
tree2976a543026c4ee79ad68bef5d970e104f684c4e /helpfuncs.go
parente5eaba1d5a6c07b3a02d38dcc81dbac49bffcc38 (diff)
Feat: props table instead of form
Diffstat (limited to 'helpfuncs.go')
-rw-r--r--helpfuncs.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/helpfuncs.go b/helpfuncs.go
index d73befe..c9f2a0d 100644
--- a/helpfuncs.go
+++ b/helpfuncs.go
@@ -152,10 +152,16 @@ func setLogLevel(sl string) {
func listRolesWithUser() []string {
roles := chatBody.ListRoles()
- if !strInSlice(cfg.UserRole, roles) {
- roles = append(roles, cfg.UserRole)
+ // Remove user role if it exists in the list (to avoid duplicates and ensure it's at position 0)
+ filteredRoles := make([]string, 0, len(roles))
+ for _, role := range roles {
+ if role != cfg.UserRole {
+ filteredRoles = append(filteredRoles, role)
+ }
}
- return roles
+ // Prepend user role to the beginning of the list
+ result := append([]string{cfg.UserRole}, filteredRoles...)
+ return result
}
func loadImage() {