diff options
| author | Grail Finder <wohilas@gmail.com> | 2025-12-03 13:29:57 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2025-12-03 13:29:57 +0300 |
| commit | cec10210c284a17cd341b48ee205bcfd278205bd (patch) | |
| tree | 2976a543026c4ee79ad68bef5d970e104f684c4e /helpfuncs.go | |
| parent | e5eaba1d5a6c07b3a02d38dcc81dbac49bffcc38 (diff) | |
Feat: props table instead of form
Diffstat (limited to 'helpfuncs.go')
| -rw-r--r-- | helpfuncs.go | 12 |
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() { |
