Fix old comments
Cette révision appartient à :
Parent
775f9c15ad
révision
1805f0f6aa
1 fichiers modifiés avec 1 ajouts et 3 suppressions
|
@ -5,7 +5,6 @@ import (
|
||||||
"github.com/ewhal/nyaa/util"
|
"github.com/ewhal/nyaa/util"
|
||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -135,8 +134,7 @@ func (t *Torrent) ToJSON() TorrentJSON {
|
||||||
magnet := util.InfoHashToMagnet(strings.TrimSpace(t.Hash), t.Name, config.Trackers...)
|
magnet := util.InfoHashToMagnet(strings.TrimSpace(t.Hash), t.Name, config.Trackers...)
|
||||||
commentsJSON := make([]CommentJSON, 0, len(t.OldComments)+len(t.Comments))
|
commentsJSON := make([]CommentJSON, 0, len(t.OldComments)+len(t.Comments))
|
||||||
for _, c := range t.OldComments {
|
for _, c := range t.OldComments {
|
||||||
escapedContent := template.HTML(html.EscapeString(c.Content))
|
commentsJSON = append(commentsJSON, CommentJSON{Username: c.Username, Content: template.HTML(c.Content), Date: c.Date})
|
||||||
commentsJSON = append(commentsJSON, CommentJSON{Username: c.Username, Content: escapedContent, Date: c.Date})
|
|
||||||
}
|
}
|
||||||
for _, c := range t.Comments {
|
for _, c := range t.Comments {
|
||||||
commentsJSON = append(commentsJSON, CommentJSON{Username: c.User.Username, Content: util.MarkdownToHTML(c.Content), Date: c.CreatedAt})
|
commentsJSON = append(commentsJSON, CommentJSON{Username: c.User.Username, Content: util.MarkdownToHTML(c.Content), Date: c.CreatedAt})
|
||||||
|
|
Référencer dans un nouveau ticket