diff options
-rw-r--r-- | mastodon/status.go | 4 | ||||
-rw-r--r-- | service/service.go | 10 | ||||
-rw-r--r-- | static/style.css | 1 | ||||
-rw-r--r-- | 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 @@ </a> <div class="more-container"> <div class="remote-link"> - {{.Visibility}} + {{if .IDNumbers}}#{{index .IDNumbers .ID}}{{end}} {{.Visibility}} </div> <div class="more-content"> <a class="more-link" href="{{.URL}}" target="_blank"> @@ -56,14 +56,14 @@ {{if .InReplyToID}} <div class="status-reply-to"> <a class="status-reply-to-link" href="{{if not .ShowReplies}}/thread/{{.InReplyToID}}{{end}}#status-{{.InReplyToID}}"> - in reply to {{if .Pleroma.InReplyToAccountAcct}}{{.Pleroma.InReplyToAccountAcct}}{{else if .ReplyNumber}}#{{.ReplyNumber}}{{else}}{{.InReplyToID}}{{end}} + in reply to {{if .IDNumbers}}#{{index .IDNumbers .InReplyToID}}{{end}} {{if .Pleroma.InReplyToAccountAcct}}{{.Pleroma.InReplyToAccountAcct}}{{else if not .IDNumbers}}{{.InReplyToID}}{{end}} </a> </div> - {{if index .ReplyMap .ID}} <span class="status-reply-info-divider"> - </span> {{end}} + {{if index .IDReplies .ID}} <span class="status-reply-info-divider"> - </span> {{end}} {{end}} {{if .ShowReplies}} - {{if index .ReplyMap .ID}} <span class="status-reply-text"> replies: </span> {{end}} - {{range index .ReplyMap .ID}} + {{if index .IDReplies .ID}} <span class="status-reply-text"> replies: </span> {{end}} + {{range index .IDReplies .ID}} <div class="status-reply"> <a class="status-reply-link" href="#status-{{.ID}}">#{{.Number}}</a> </div> |