{{define "title"}}Message Inbox{{end}} {{define "content"}}

Messages

{{if eq .Box "threads"}} Conversation Threads {{else if eq .Box "sent"}} Sent {{else}} Inbox {{end}}

{{$Root := .}} {{$UserMap := .UserMap}} {{$Request := .Request}}
{{if .ViewThread}}
To:
{{template "avatar-24x24" .ReplyTo}}
{{InputCSRF}}

Markdown formatting supported.

Reminder: don't share sensitive information over Direct Messages. Please review the Privacy Policy and Terms of Service as it pertains to DMs on the main website and the chat room.

{{range .ViewThread}}
{{$SourceUser := $UserMap.Get .SourceUserID}}
{{template "avatar-64x64" $SourceUser}}

{{$SourceUser.NameOrUsername}} {{if $SourceUser.IsAdmin}} Admin {{end}}

{{$SourceUser.Username}} {{if not $SourceUser.Certified}} Not Certified! {{end}}

{{ToMarkdown .Message}}
Sent {{SincePrettyCoarse .CreatedAt}} ago {{if not .Read}}UNREAD{{end}} {{if eq $Root.CurrentUser.ID $SourceUser.ID}}
{{InputCSRF}}
{{end}}

{{end}}
Found {{.ThreadPager.Total}} message{{Pluralize64 .ThreadPager.Total}} in this thread (page {{.ThreadPager.Page}} of {{.ThreadPager.Pages}}).
{{InputCSRF}}
{{if .ThreadPager.HasPrevious}} Previous {{end}} {{if .ThreadPager.HasNext}} Next Page {{end}}
{{else}}

You have {{.Unread}} unread message{{Pluralize64 .Unread}}. Select a message on the other column to read the conversation here.

{{end}}
{{if eq .Box "threads"}}
Showing {{.Pager.Total}} conversation threads with others (ordered by most recent, grouped by sender name). Note: messages you have Sent but which have not been replied to will only appear on the "Sent" tab.
{{else if eq .Box "inbox"}}
Showing all {{.Pager.Total}} inbound messages to you, ordered by most recent.
{{else if eq .Box "sent"}}
Showing {{.Pager.Total}} messages sent by you to other people.
{{end}} {{range .Messages}} {{end}}
{{if eq $Root.Box "sent"}} {{$User := $UserMap.Get .TargetUserID}}
Sent To
{{template "avatar-24x24" $User}}
{{$User.Username}}
{{else}} {{$User := $UserMap.Get .SourceUserID}}
From
{{template "avatar-24x24" $User}}
{{$User.Username}}
{{end}}
Found {{.Pager.Total}} {{if eq .Box "threads"}}conversation{{else}}message{{end}}{{Pluralize64 .Pager.Total}} (page {{.Pager.Page}} of {{.Pager.Pages}}).
{{if .Pager.HasPrevious}} Previous {{end}} {{if .Pager.HasNext}} Next Page {{end}}
{{end}}