rename replay query parameter to initChannelState
Some checks failed
check / check (push) Has been cancelled
Some checks failed
check / check (push) Has been cancelled
Rename ?replay=1 to ?initChannelState=1 across server, SPA, and docs per review feedback: the parameter initialises fresh channel state rather than replaying past state. - Rename replayChannelState() to initChannelState() - Update query parameter check in HandleState - Update SPA fetch URL and comments - Update README documentation and curl examples
This commit is contained in:
@@ -444,10 +444,11 @@ func (hdlr *Handlers) enqueueNumeric(
|
||||
}
|
||||
|
||||
// HandleState returns the current session's info and
|
||||
// channels. When called with ?replay=1, it also enqueues
|
||||
// synthetic JOIN + TOPIC + NAMES messages for every channel
|
||||
// the session belongs to so that a reconnecting client can
|
||||
// rebuild its channel tabs from the message stream.
|
||||
// channels. When called with ?initChannelState=1, it also
|
||||
// enqueues synthetic JOIN + TOPIC + NAMES messages for every
|
||||
// channel the session belongs to so that a reconnecting
|
||||
// client can rebuild its channel tabs from the message
|
||||
// stream.
|
||||
func (hdlr *Handlers) HandleState() http.HandlerFunc {
|
||||
return func(
|
||||
writer http.ResponseWriter,
|
||||
@@ -475,8 +476,8 @@ func (hdlr *Handlers) HandleState() http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
if request.URL.Query().Get("replay") == "1" {
|
||||
hdlr.replayChannelState(
|
||||
if request.URL.Query().Get("initChannelState") == "1" {
|
||||
hdlr.initChannelState(
|
||||
request, clientID, sessionID, nick,
|
||||
)
|
||||
}
|
||||
@@ -489,12 +490,12 @@ func (hdlr *Handlers) HandleState() http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// replayChannelState enqueues synthetic JOIN messages and
|
||||
// initChannelState enqueues synthetic JOIN messages and
|
||||
// join-numerics (TOPIC, NAMES) for every channel the
|
||||
// session belongs to. Messages are enqueued only to the
|
||||
// specified client so other clients/sessions are not
|
||||
// affected.
|
||||
func (hdlr *Handlers) replayChannelState(
|
||||
func (hdlr *Handlers) initChannelState(
|
||||
request *http.Request,
|
||||
clientID, sessionID int64,
|
||||
nick string,
|
||||
@@ -516,7 +517,7 @@ func (hdlr *Handlers) replayChannelState(
|
||||
)
|
||||
if insErr != nil {
|
||||
hdlr.log.Error(
|
||||
"replay: insert JOIN",
|
||||
"initChannelState: insert JOIN",
|
||||
"error", insErr,
|
||||
)
|
||||
|
||||
|
||||
@@ -182,9 +182,9 @@ func (hdlr *Handlers) handleLogin(
|
||||
request, clientID, sessionID, payload.Nick,
|
||||
)
|
||||
|
||||
// Replay channel state so the new client knows which
|
||||
// Init channel state so the new client knows which
|
||||
// channels the session already belongs to.
|
||||
hdlr.replayChannelState(
|
||||
hdlr.initChannelState(
|
||||
request, clientID, sessionID, payload.Nick,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user