Skip to content

Commit

Permalink
sort msgs history on wenichats ticket open
Browse files Browse the repository at this point in the history
  • Loading branch information
rasoro committed Jan 12, 2024
1 parent 91da703 commit f6b3380
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions services/tickets/wenichats/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
"sort"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -168,6 +169,10 @@ func (s *service) Open(session flows.Session, topic *flows.Topic, body string, a
msgs = append(msgs, frmsgs...)
}

sort.Slice(msgs, func(i, j int) bool {
return msgs[i].CreatedOn().Before(msgs[j].CreatedOn())
})

//send history
for _, msg := range msgs {
var direction string
Expand Down

0 comments on commit f6b3380

Please sign in to comment.