Show quoted posts

This commit is contained in:
r 2024-06-17 11:41:02 +00:00
parent ce1680dfd0
commit 61c166b795
4 changed files with 35 additions and 1 deletions

View File

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

View File

@ -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,

View File

@ -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;

View File

@ -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>