Show status numbers
authorr <r@freesoftwareextremist.com>
Fri, 5 Jun 2020 06:27:59 +0000 (06:27 +0000)
committerr <r@freesoftwareextremist.com>
Fri, 5 Jun 2020 06:28:50 +0000 (06:28 +0000)
mastodon/status.go
service/service.go
static/style.css
templates/status.tmpl

index b4f57ae308dbb68cc888fdfcd45b8b5531f4faca..7a29b99e3dbb92f6d3d82c1ebc6f03a2bebff3ce 100644 (file)
@@ -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"`
 }
 
index 063624c2c3c9ddec493d9ab39e77524d77322cd0..2c4f0b00bdfeb1403be67b6344fe07e946c55917 100644 (file)
@@ -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)
index 8410c77bc44e93f46389369f78c301f4a488689c..f7f9ab67bb71f4657277cea7f938f1c5f0ad1eb4 100644 (file)
@@ -438,6 +438,7 @@ img.emoji {
        background-color: #ffffff;
        padding: 2px 4px;
        border: 1px solid #aaaaaa;
+       right: 0;
 }
 
 .more-container:hover .more-content {
index 18e6d9a12a07d91c7bf389986056bb6a4caffe55..ec0d2978af995013ec54cd0e83aeab1b14e9996f 100644 (file)
@@ -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">
                                {{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>