From eb3bc15da9617cf119d1c16365ec9e0c90a7549f Mon Sep 17 00:00:00 2001 From: r Date: Fri, 5 Jun 2020 06:27:59 +0000 Subject: Show status numbers --- mastodon/status.go | 4 ++-- service/service.go | 10 +++++++--- static/style.css | 1 + templates/status.tmpl | 10 +++++----- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/mastodon/status.go b/mastodon/status.go index b4f57ae..7a29b99 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -52,8 +52,8 @@ type Status struct { // Custom fields Pleroma StatusPleroma `json:"pleroma"` ShowReplies bool `json:"show_replies"` - ReplyMap map[string][]ReplyInfo `json:"reply_map"` - ReplyNumber int `json:"reply_number"` + IDReplies map[string][]ReplyInfo `json:"id_replies"` + IDNumbers map[string]int `json:"id_numbers"` RetweetedByID string `json:"retweeted_by_id"` } diff --git a/service/service.go b/service/service.go index 063624c..2c4f0b0 100644 --- a/service/service.go +++ b/service/service.go @@ -342,12 +342,16 @@ func (svc *service) ServeThreadPage(c *model.Client, id string, reply bool) (err statuses := append(append(context.Ancestors, status), context.Descendants...) replies := make(map[string][]mastodon.ReplyInfo) + idNumbers := make(map[string]int) for i := range statuses { statuses[i].ShowReplies = true - statuses[i].ReplyMap = replies - statuses[i].ReplyNumber = i - addToReplyMap(replies, statuses[i].InReplyToID, statuses[i].ID, i+1) + + statuses[i].IDNumbers = idNumbers + idNumbers[statuses[i].ID] = i + 1 + + statuses[i].IDReplies = replies + addToReplyMap(replies, statuses[i].InReplyToID, statuses[i].ID, i + 1) } commonData := svc.getCommonData(c, "post by "+status.Account.DisplayName) diff --git a/static/style.css b/static/style.css index 8410c77..f7f9ab6 100644 --- a/static/style.css +++ b/static/style.css @@ -438,6 +438,7 @@ img.emoji { background-color: #ffffff; padding: 2px 4px; border: 1px solid #aaaaaa; + right: 0; } .more-container:hover .more-content { diff --git a/templates/status.tmpl b/templates/status.tmpl index 18e6d9a..ec0d297 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -26,7 +26,7 @@
@@ -56,14 +56,14 @@ {{if .InReplyToID}} - {{if index .ReplyMap .ID}} - {{end}} + {{if index .IDReplies .ID}} - {{end}} {{end}} {{if .ShowReplies}} - {{if index .ReplyMap .ID}} replies: {{end}} - {{range index .ReplyMap .ID}} + {{if index .IDReplies .ID}} replies: {{end}} + {{range index .IDReplies .ID}} -- cgit v1.2.3