From cec10210c284a17cd341b48ee205bcfd278205bd Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Wed, 3 Dec 2025 13:29:57 +0300 Subject: Feat: props table instead of form --- helpfuncs.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'helpfuncs.go') 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() { -- cgit v1.2.3