Add a non-hoist group to the users view (maybe think of a better name?)
@@ -341,11 +341,16 @@ func (window *Window) UpdateUsersForGuild(guild *discordgo.UserGuild) {
for _, role := range roles {
if role.Hoist {
roleNode := tview.NewTreeNode(role.Name)
+ roleNode.SetSelectable(false)
roleNodes[role.ID] = roleNode
window.userRootNode.AddChild(roleNode)
}
}
+ nonHoistNode := tview.NewTreeNode("No Hoist Role")
+ nonHoistNode.SetSelectable(false)
+ window.userRootNode.AddChild(nonHoistNode)
+
USER:
for _, user := range users {
@@ -387,7 +392,14 @@ func (window *Window) UpdateUsersForGuild(guild *discordgo.UserGuild) {
}
}
- window.userRootNode.AddChild(userNode)
+ nonHoistNode.AddChild(userNode)
+ }
+
+ if window.userContainer.GetCurrentNode() == nil {
+ userNodes := window.userRootNode.GetChildren()
+ if userNodes != nil && len(userNodes) > 0 {
+ window.userContainer.SetCurrentNode(window.userRootNode.GetChildren()[0])
+ }
}
})
}
