{{define "components/composer.html"}} {{$inReplyToID := .InReplyToID}} {{$replyMention := replyMention .ReplyTo}} {{$replyMentions := replyMentions .ReplyTo .Account}} {{$parentVis := .ParentVisibility}} {{$quoteOf := .QuoteOf}} {{$editing := .EditingID}} {{$redrafting := .RedraftStatusID}} {{$draftContent := .DraftContent}} {{$draftMarkdown := .DraftMarkdown}} {{if not .DraftMarkdownSet}}{{$draftMarkdown = .Account.DefaultPostMarkdown}}{{end}} {{$draftSummary := .DraftSummary}} {{$draftSensitive := .DraftSensitive}} {{$draftIsBlogPost := .DraftIsBlogPost}} {{$draftBlogSlug := .DraftBlogSlug}} {{$draftExpiresAt := .DraftExpiresAt}} {{$composerID := or .ComposerID "composer"}} {{/* Edit/redraft keeps its language; a reply inherits its parent's; otherwise use the account default. */}} {{$draftLang := .DraftLanguage}} {{if and (not $draftLang) .ReplyTo}}{{$draftLang = .ReplyTo.Language}}{{end}} {{if not $draftLang}}{{$draftLang = or .Account.DefaultPostLanguage "en"}}{{end}} {{$existingMedia := .ExistingMedia}} {{/* Resolved visibility: draft/redraft or parent (reply) takes precedence. */}} {{$vis := or .Account.DefaultPostVisibility "public"}} {{if $parentVis}}{{$vis = $parentVis}}{{end}} {{if .DraftVisibility}}{{$vis = .DraftVisibility}}{{end}} {{/* Server-rendered prefill so the composer works without JavaScript. */}} {{$prefill := ""}} {{if $draftContent}}{{$prefill = $draftContent}}{{else if $replyMentions}}{{$prefill = printf "%s " $replyMentions}}{{end}} {{/* A fresh composer starts collapsed: only the text field and Post button, with the options revealed once the user focuses the editor. A reply counts as fresh, since its only content is the mention prefix. Any composer that already carries written content (quote, edit, draft) opens expanded. */}} {{$startExpanded := or $editing $redrafting $quoteOf $draftContent $existingMedia $draftSummary $draftSensitive $draftIsBlogPost}} {{$action := "/statuses"}} {{if $editing}}{{$action = printf "/statuses/%s/edit" $editing}}{{end}}
{{if $redrafting}}{{end}} {{if and $inReplyToID (not $editing) (not $redrafting)}} {{end}} {{if and $quoteOf (not $editing)}} {{end}}
{{if $editing}}
{{T "composer.editing"}}
{{end}} {{if $redrafting}}
{{T "composer.redrafting"}}
{{end}} {{if $replyMention}}
{{T "status.replying_to"}} {{$replyMention}}
{{else if and $redrafting .RedraftReplyURI}}
{{T "status.reply_unavailable"}}
{{end}} {{if $quoteOf}}
{{T "composer.quoting"}} {{if $quoteOf.Account.Domain}}@{{$quoteOf.Account.Username}}@{{$quoteOf.Account.Domain}}{{else}}@{{$quoteOf.Account.Username}}{{end}}
{{localizeStatusHTML $quoteOf.ContentHTML}}
{{end}}
{{/* The preview only ever fills in under JavaScript, so its status line arrives from the form dataset. Written into the page it would read as "rendering" forever in a browser that renders nothing. */}}

{{range $existingMedia}}
{{if eq .Type "image"}}{{.Description}} {{else if eq .Type "video"}} {{else if eq .Type "audio"}} {{else}}{{.Type}}{{end}} {{if .Description}}
{{.Description}}
{{end}}
{{end}}