diff --git a/internal/webserver/handler_messages.go b/internal/webserver/handler_messages.go index 9446b89..11afa11 100644 --- a/internal/webserver/handler_messages.go +++ b/internal/webserver/handler_messages.go @@ -14,6 +14,7 @@ import ( type MessageData struct { persistence.DMChatView LatestPollingTimestamp int + ScrollBottom bool } func (app *Application) Messages(w http.ResponseWriter, r *http.Request) { @@ -28,7 +29,7 @@ func (app *Application) Messages(w http.ResponseWriter, r *http.Request) { room_id := scraper.DMChatRoomID(parts[0]) if r.URL.Query().Has("poll") { - // TODO: where is this going to be used? + // Not run as a goroutine; this call blocks. It's not actually "background" app.background_dm_polling_scrape() } @@ -57,6 +58,9 @@ func (app *Application) Messages(w http.ResponseWriter, r *http.Request) { chat_view_data.LatestPollingTimestamp, err = strconv.Atoi(latest_timestamp_str) panic_if(err) } + if r.URL.Query().Get("scroll_bottom") != "0" { + chat_view_data.ScrollBottom = true + } chat_contents := app.Profile.GetChatRoomContents(room_id, chat_view_data.LatestPollingTimestamp) chat_view_data.MergeWith(chat_contents.DMTrove) chat_view_data.MessageIDs = chat_contents.MessageIDs diff --git a/internal/webserver/tpl/messages.tpl b/internal/webserver/tpl/messages.tpl index b01ffc5..a36221d 100644 --- a/internal/webserver/tpl/messages.tpl +++ b/internal/webserver/tpl/messages.tpl @@ -1,4 +1,4 @@ -{{define "title"}}Followed Users{{end}} +{{define "title"}}Messages{{end}} {{define "main"}}
diff --git a/internal/webserver/tpl/tweet_page_includes/chat_list.tpl b/internal/webserver/tpl/tweet_page_includes/chat_list.tpl index 560d096..6c17fd0 100644 --- a/internal/webserver/tpl/tweet_page_includes/chat_list.tpl +++ b/internal/webserver/tpl/tweet_page_includes/chat_list.tpl @@ -3,5 +3,12 @@ {{range .RoomIDs}} {{template "chat-list-entry" (dict "room" (index $.Rooms .) "messages" $.DMTrove.Messages "is_active" (eq $.ActiveRoomID .))}} {{end}} + + {{/* Scroll the active chat into view, if there is one */}} + {{if $.ActiveRoomID}} + + {{end}}
{{end}} diff --git a/internal/webserver/tpl/tweet_page_includes/chat_view.tpl b/internal/webserver/tpl/tweet_page_includes/chat_view.tpl index ae2f0a8..a737da5 100644 --- a/internal/webserver/tpl/tweet_page_includes/chat_view.tpl +++ b/internal/webserver/tpl/tweet_page_includes/chat_view.tpl @@ -53,9 +53,9 @@ {{end}}
{{end}} @@ -88,6 +88,43 @@ {{end}} + + {{end}} {{define "dm-composer"}}