{{define "messages"}} {{range .MessageIDs}} {{$message := (index $.DMTrove.Messages .)}} {{$user := (user $message.SenderID)}} {{$is_us := (eq $message.SenderID (active_user).ID)}}
{{template "circle-profile-img" $user}}
{{if (ne $message.InReplyToID 0)}}
{{(index $.DMTrove.Messages $message.InReplyToID).Text}}
{{end}} {{if (ne $message.EmbeddedTweetID 0)}}
{{template "tweet" (dict "TweetID" $message.EmbeddedTweetID "RetweetID" 0 "QuoteNestingLevel" 1) }}
{{end}} {{range $message.Images}} {{end}} {{range $message.Videos}} {{end}} {{range $message.Urls}} {{template "embedded-link" .}} {{end}} {{if $message.Text}}
{{template "text-with-entities" $message.Text}}
{{end}}
{{range $message.Reactions}} {{$sender := (user .SenderID)}} {{.Emoji}} {{end}}

{{$message.SentAt.Time.Format "Jan 2, 2006 @ 3:04 pm"}}

{{end}} {{end}} {{define "messages-with-poller"}} {{template "messages" .}}
{{end}} {{define "composer-polling-timestamp-field"}} {{end}} {{define "chat-view"}}
{{if .ActiveRoomID}}
{{ $room := (index $.Rooms $.ActiveRoomID) }} {{template "chat-profile-image" $room}}
{{if (ne $room.Type "ONE_TO_ONE")}} {{end}}
{{end}}
{{if .ActiveRoomID}} {{template "conversation-top" .}} {{template "messages-with-poller" .}} {{end}}
{{if .ActiveRoomID}}
{{template "dm-composer"}} {{template "composer-polling-timestamp-field" (dict "LatestPollingTimestamp" .LatestPollingTimestamp "oob" false)}}
{{ $room := (index $.Rooms $.ActiveRoomID) }} {{if (ne $room.Type "ONE_TO_ONE")}}

People

{{template "list" (dict "UserIDs" $room.GetParticipantIDs)}}
{{end}} {{end}}
{{end}} {{define "dm-composer"}} {{end}} {{define "conversation-top"}}
{{if .Cursor.CursorPosition.IsEnd}} {{else}} Show more {{end}}
{{end}} {{/* convenience template for htmx requests */}} {{define "messages-top"}} {{template "conversation-top" .}} {{template "messages" .}} {{end}}