Load the lead's scrollback 50 turns at a time
This commit is contained in:
@@ -2,6 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -17,6 +18,24 @@ func (s *Server) ListLeadSessions(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, sessions)
|
||||
}
|
||||
|
||||
func (s *Server) ListLeadEvents(w http.ResponseWriter, r *http.Request, params api.ListLeadEventsParams) {
|
||||
before := int64(math.MaxInt64)
|
||||
if params.Before != nil {
|
||||
before = *params.Before
|
||||
}
|
||||
turns := 50
|
||||
if params.Turns != nil {
|
||||
turns = *params.Turns
|
||||
}
|
||||
|
||||
page, err := s.store.LeadEventsPage(r.Context(), actor(r), before, turns)
|
||||
if err != nil {
|
||||
writeStoreError(w, err)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, page)
|
||||
}
|
||||
|
||||
func (s *Server) MessageLead(w http.ResponseWriter, r *http.Request) {
|
||||
req := api.MessageCreate{}
|
||||
if !readJSON(w, r, &req) {
|
||||
|
||||
Reference in New Issue
Block a user