bloat/templates/status.tmpl

315 lines
13 KiB
Cheetah

{{with .Data}}
{{if .Muted}}<details><summary> muted post </summary>{{end}}
<div id="status-{{.ID}}" class="status-container-container">
{{if .Reblog}}
<details>
<summary>
<div class="retweet-info">
<a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.Avatar}}" title="@{{.Account.Acct}}" alt="avatar" height="24" />
</a>
<bdi class="status-dname">{{EmojiFilter (HTML .Account.DisplayName) .Account.Emojis | Raw}}</bdi>
<a href="/user/{{.Account.ID}}">
<span class="status-uname">@{{.Account.Acct}}</span>
</a>
retweeteed
</div>
</summary>
{{template "status" (WithContext .Reblog $.Ctx)}}
</details>
{{else}}
{{block "status" (WithContext . $.Ctx)}}
{{with $s := .Data}}
<div class="status-container status-{{.ID}}" data-id="{{.ID}}">
<div class="status-profile-img-container">
<a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.Avatar}}" title="@{{.Account.Acct}}" alt="avatar" height="48" />
</a>
</div>
<div class="status">
<div class="status-name">
<bdi class="status-dname"> {{EmojiFilter (HTML .Account.DisplayName) .Account.Emojis | Raw}} {{if .Account.Bot}}🤖{{end}}</bdi>
<a href="/user/{{.Account.ID}}">
<span class="status-uname">@{{.Account.Acct}}</span>
</a>
<div class="more-container">
<div class="remote-link">
{{if .IDNumbers}}#{{index .IDNumbers .ID}}{{end}} {{.Visibility}} <code title="Status ID">{{.ID}}</code>
</div>
<div class="more-content">
<a class="more-link" href="{{.URL}}" target="_blank">
source
</a>
<a class="more-link" href="/quickreply/{{.ID}}#status-{{.ID}}">
quickreply
</a>
{{if .Muted}}
<form action="/unmuteconv/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="submit" value="unmute" class="btn-link more-link">
</form>
{{else}}
<form action="/muteconv/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="submit" value="mute" class="btn-link more-link">
</form>
{{end}}
{{if .Bookmarked}}
<form action="/unbookmark/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="unbookmark" class="btn-link more-link">
</form>
{{else}}
<form action="/bookmark/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="bookmark" class="btn-link more-link">
</form>
{{end}}
{{if eq $.Ctx.UserID .Account.ID}}
{{$pin := "pin"}} {{if .Pinned}} {{$pin = "unpin"}} {{end}}
<form action="/{{$pin}}/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="submit" value="{{$pin}}" class="btn-link more-link">
</form>
<form action="/delete/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="submit" value="delete" class="btn-link more-link">
</form>
{{end}}
</div>
</div>
</div>
<div class="status-reply-container">
{{if .InReplyToID}}
<a class="status-reply-to-link" href="{{if not .ShowReplies}}/thread/{{.InReplyToID}}{{end}}#status-{{.InReplyToID}}">
in reply to {{if .IDNumbers}}#{{index .IDNumbers .InReplyToID}}{{end}} {{if .Pleroma.InReplyToAccountAcct}}@{{.Pleroma.InReplyToAccountAcct}}{{else if not .IDNumbers}}{{.InReplyToID}}{{end}}
</a>
{{if index .IDReplies .ID}} <span class="status-reply-info-divider"> - </span> {{end}}
{{end}}
{{if .ShowReplies}}
{{if index .IDReplies .ID}} <span class="status-reply-text"> replies: </span> {{end}}
{{range index .IDReplies .ID}}
<a class="status-reply-link" href="#status-{{.ID}}">#{{.Number}}</a>
{{end}}
{{end}}
</div>
{{if (or .Content .SpoilerText)}}
<div class="status-content">
{{if .Sensitive}}[NSFW]<br/>{{end}}
{{- if .SpoilerText}}{{EmojiFilter (HTML .SpoilerText) .Emojis | Raw}}<br/>{{end -}}
{{if .Sensitive}}<details>{{end}}
{{- StatusContentFilter .Content .Emojis .Mentions | Raw -}}
{{if .Pleroma.Quote}}
<details>
<summary>quoted post</summary>
{{template "status" (WithContext .Pleroma.Quote $.Ctx)}}
</details>
{{end}}
{{if .Sensitive}}</details>{{end}}
</div>
{{end}}
{{$st_id := .ID}}
{{if .Pleroma.Reactions}}
<div class="pleroma-reactions">
{{range .Pleroma.Reactions}}
{{$react := "react"}} {{if .Me}} {{$react = "unreact"}} {{end}}
<form id="emoj" action="/{{$react}}-with/{{$st_id}}?emoji={{.Name}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
{{if .Url}}
<input id="place-{{$react}}" type="image" src="{{.Url}}" title="{{.Name}}{{.Count}}*" {{if eq $react "unreact"}}height=36 width=36 {{else}} height=32 width=32 {{end}} class="pleroma-emoji">
{{else}}
<input id="place-{{$react}}" type="submit" value="{{.Name}}{{.Count}}{{if eq $react "unreact"}}*{{end}}" class="pleroma-emoji">
{{end}}
</form>
{{end}}
</div>
{{end}}
{{if .MediaAttachments}}
{{if .Sensitive}}<details><summary>NSFW attachments</summary>{{end}}
<div class="status-media-container">
{{range .MediaAttachments}}
{{if eq .Type "image"}}
{{if $.Ctx.HideAttachments}}
<a href="{{.URL}}" target="_blank">
[image{{if $s.Sensitive}}/nsfw{{end}}{{if .Description}}: {{.Description}}{{end}}]
</a>
{{else}}
<a class="img-link" href="{{.URL}}" target="_blank" title="{{.Description}}">
<img class="status-image" src="{{.PreviewURL}}" alt="status-image" height="240" loading="lazy" />
{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
<div class="status-nsfw-overlay"></div>
{{end}}
</a>
{{end}}
{{else if eq .Type "audio"}}
{{if $.Ctx.HideAttachments}}
<a href="{{.URL}}" target="_blank">
[audio{{if $s.Sensitive}}/nsfw{{end}}{{if .Description}}: {{.Description}}{{end}}]
</a>
{{else}}
<audio class="status-audio" controls title="{{.Description}}">
<source src="{{.URL}}">
<a href="{{.URL}}" target="_blank"> [audio] </a>
</audio>
{{end}}
{{else if eq .Type "video"}}
{{if $.Ctx.HideAttachments}}
<a href="{{.URL}}" target="_blank">
[video{{if $s.Sensitive}}/nsfw{{end}}{{if .Description}}: {{.Description}}{{end}}]
</a>
{{else}}
<div class="status-video-container" title="{{.Description}}">
<video class="status-video" controls height="240">
<source src="{{.URL}}">
<a href="{{.URL}}" target="_blank"> [video] </a>
</video>
{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
<div class="status-nsfw-overlay"></div>
{{end}}
</div>
{{end}}
{{else}}
<a href="{{.URL}}" target="_blank">
[attachment{{if $s.Sensitive}}/nsfw{{end}}{{if .Description}}: {{.Description}}{{end}}]
</a>
{{end}}
{{end}}
</div>
{{if .Sensitive}}</details>{{end}}
{{end}}
{{if .Poll}}
<form class="poll-form" action="/vote/{{.Poll.ID}}" method="POST" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="hidden" name="status_id" value="{{$s.ID}}">
{{range $i, $o := .Poll.Options}}
<div class="poll-option">
{{if (or $s.Poll.Expired $s.Poll.Voted)}}
<div> {{EmojiFilter (HTML $o.Title) $s.Emojis | Raw}} - {{$o.VotesCount}} votes </div>
{{else}}
<input type="{{if $s.Poll.Multiple}}checkbox{{else}}radio{{end}}" name="choices"
id="poll-{{$s.ID}}-{{$i}}" value="{{$i}}">
<label for="poll-{{$s.ID}}-{{$i}}">
{{EmojiFilter (HTML $o.Title) $s.Emojis | Raw}}
</label>
{{end}}
</div>
{{end}}
{{if not (or .Poll.Expired .Poll.Voted)}}
<button type="submit"> Vote </button>
{{end}}
<div class="poll-info">
<span>{{.Poll.VotesCount}} votes</span>
{{if .Poll.Expired}}
<span> - poll expired </span>
{{else if .Poll.ExpiresAt}}
<span>
- poll ends in
<time datetime="{{FormatTimeRFC3339 .Poll.ExpiresAt}}" title="{{FormatTimeRFC822 .Poll.ExpiresAt}}">
{{TimeUntil .Poll.ExpiresAt}}
</time>
</span>
{{end}}
</div>
</form>
{{end}}
<div class="status-action-container">
{{if eq (printf "%.7s" .URL) "/search"}}
<div class="status-action">
<a href="{{.URL}}">Federate!</a>
</div>
{{else}}
<div class="status-action">
<a href="/thread/{{.ID}}?reply=true#status-{{.ID}}">
reply
</a>
<a class="status-reply-count" href="/thread/{{.ID}}#status-{{.ID}}" {{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}>
{{if and (not $.Ctx.AntiDopamineMode) .RepliesCount}}
({{DisplayInteractionCount .RepliesCount}})
{{end}}
</a>
</div>
{{end}}
<div class="status-action">
{{$rt := "retweet"}} {{if .Reblogged}} {{$rt = "unretweet"}} {{end}}
<form class="status-retweet" data-action="{{$rt}}" action="/{{$rt}}/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<div class="more-container">
<input type="submit" value="{{$rt}}" class="btn-link"
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}title="this status cannot be retweeted" disabled{{end}}>
<div class="more-content">
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}
Locked
{{else}}
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="public" checked>
<label for="retweet_visibility">public</label>
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="unlisted">
<label for="retweet_visibility">unlisted</label>
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="private">
<label for="retweet_visibility">private</label>
{{end}}
</div>
</div>
<a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list">
{{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}}
({{DisplayInteractionCount .ReblogsCount}})
{{end}}
</a>
</form>
</div>
<div class="status-action">
{{$like := "like"}} {{if .Favourited}} {{$like = "unlike"}} {{end}}
<form class="status-like" data-action="{{$like}}" action="/{{$like}}/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="{{$like}}" class="btn-link">
<a class="status-like-count" href="/likedby/{{.ID}}" title="click to see the the list">
{{if and (not $.Ctx.AntiDopamineMode) .FavouritesCount}}
({{DisplayInteractionCount .FavouritesCount}})
{{end}}
</a>
</form>
</div>
<div class="status-action">
<a href="/reactionspage/{{.ID}}">
reactions
</a>
</div>
<div class="status-action status-action-last">
<a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"
{{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}>
<time datetime="{{FormatTimeRFC3339 .CreatedAt.Time}}" title="{{FormatTimeRFC822 .CreatedAt.Time}}">
{{TimeSince .CreatedAt.Time}}
</time>
</a>
{{if .EditedAt}} <time datetime="{{FormatTimeRFC3339 .EditedAt.Time}}" title="{{FormatTimeRFC822 .EditedAt.Time}}">| {{TimeSince .EditedAt.Time}} Edited</time>{{end}}
</div>
</div>
</div>
</div>
{{end}}
{{end}}
{{end}}
</div>
{{if .Muted}}</details>{{end}}
{{end}}