diff options
author | r <r@freesoftwareextremist.com> | 2024-06-17 11:41:02 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2024-06-17 11:41:02 +0000 |
commit | 61c166b79570219a515bb3b8dd344a403708b371 (patch) | |
tree | 81d2ebb603d86d3b7c3580de46a25c5acc4af224 | |
parent | ce1680dfd050990d8f3e484b92eb0db350bc3f2c (diff) | |
download | bloat-61c166b79570219a515bb3b8dd344a403708b371.tar.gz bloat-61c166b79570219a515bb3b8dd344a403708b371.zip |
Show quoted posts
-rw-r--r-- | mastodon/status.go | 5 | ||||
-rw-r--r-- | renderer/renderer.go | 12 | ||||
-rw-r--r-- | static/style.css | 12 | ||||
-rw-r--r-- | templates/status.tmpl | 7 |
4 files changed, 35 insertions, 1 deletions
diff --git a/mastodon/status.go b/mastodon/status.go index 20f74a5..d009a7f 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -13,7 +13,10 @@ import ( ) type StatusPleroma struct { - InReplyToAccountAcct string `json:"in_reply_to_account_acct"` + InReplyToAccountAcct string `json:"in_reply_to_account_acct"` + Quote *Status `json:"quote"` + QuoteID string `json:"quote_id"` + QuoteVisible bool `json:"quote_visible"` } type ReplyInfo struct { diff --git a/renderer/renderer.go b/renderer/renderer.go index a88bb9e..e97fee4 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -68,6 +68,17 @@ func statusContentFilter(content string, emojis []mastodon.Emoji, mentions []mas return strings.NewReplacer(replacements...).Replace(content) } +func getQuote(s *mastodon.Status) *mastodon.Status { + if s.Pleroma.Quote == nil || !s.Pleroma.QuoteVisible { + return nil + } + q := s.Pleroma.Quote + q.RetweetedByID = s.ID + // Disable nested quotes + q.Pleroma.QuoteVisible = false + return q +} + func displayInteractionCount(c int64) string { if c > 0 { return strconv.Itoa(int(c)) @@ -145,6 +156,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) { t, err = t.Funcs(template.FuncMap{ "EmojiFilter": emojiFilter, "StatusContentFilter": statusContentFilter, + "GetQuote": getQuote, "DisplayInteractionCount": displayInteractionCount, "TimeSince": timeSince, "TimeUntil": timeUntil, diff --git a/static/style.css b/static/style.css index ad5a360..71f64d7 100644 --- a/static/style.css +++ b/static/style.css @@ -55,6 +55,13 @@ body, position: relative; } +.status-quote { + margin: 4px 0; + padding: 8px; + background-color: #e6e6e6; + background-color: #dadada99; +} + .status-content { margin: 4px 0; max-height: 600px; @@ -585,6 +592,11 @@ input:disabled::file-selector-button { background-color: #2f2f2f99; } +.dark .status-quote { + background-color: #202020; + background-color: #26262699; +} + .dark #reply-popup, .dark #reply-to-popup { background-color: #181818; diff --git a/templates/status.tmpl b/templates/status.tmpl index 503b6f1..d841a93 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -177,6 +177,13 @@ </div> </form> {{end}} + {{with $quote := GetQuote .}} + {{if $quote}} + <div class="status-quote"> + {{template "status" (WithContext $quote $.Ctx)}} + </div> + {{end}} + {{end}} <div class="status-action-container"> <div class="status-action"> <a href="/thread/{{.ID}}?reply=true#status-{{.ID}}">reply</a> |