Use channel ID to sort private channels by default (#243)

Co-authored-by: ayntgl <90600421+ayntgl@users.noreply.github.com>
This commit is contained in:
Dan Dryaev 2022-11-01 19:09:15 +00:00 • committed by GitHub
parent cc0df3e255
commit 50174ef0d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,7 +86,15 @@ func (v *ChannelsView) createPrivateChannelNodes(root *tview.TreeNode) {
}
sort.Slice(cs, func(i, j int) bool {
return cs[i].LastMessageID > cs[j].LastMessageID
idUsed := discord.MessageID(cs[i].ID)
idUsed2 := discord.MessageID(cs[j].ID)
if cs[i].LastMessageID.IsValid() {
idUsed = cs[i].LastMessageID
}
if cs[j].LastMessageID.IsValid() {
idUsed2 = cs[j].LastMessageID
}
return idUsed > idUsed2
})
for _, c := range cs {