{{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}}