mirror of
https://github.com/teacat/chaturbate-dvr.git
synced 2025-10-29 16:59:59 +00:00
Fixed #115, IsOnline first then A-Z order
This commit is contained in:
@@ -162,7 +162,12 @@ func (m *Manager) ChannelInfo() []*entity.ChannelInfo {
|
||||
})
|
||||
|
||||
sort.Slice(channels, func(i, j int) bool {
|
||||
return channels[i].CreatedAt > channels[j].CreatedAt
|
||||
// First priority: Online channels
|
||||
if channels[i].IsOnline != channels[j].IsOnline {
|
||||
return channels[i].IsOnline
|
||||
}
|
||||
// Second priority: Alphabetical order by username
|
||||
return strings.ToLower(channels[i].Username) < strings.ToLower(channels[j].Username)
|
||||
})
|
||||
|
||||
return channels
|
||||
|
||||
Reference in New Issue
Block a user