révision
985c6f9e68
3 fichiers modifiés avec 6 ajouts et 1 suppressions
|
@ -132,7 +132,11 @@ func (t *Torrent) ToJSON() TorrentJSON {
|
|||
commentsJSON = append(commentsJSON, CommentJSON{Username: c.Username, UserID: -1, Content: template.HTML(c.Content), Date: c.Date.UTC()})
|
||||
}
|
||||
for _, c := range t.Comments {
|
||||
if (c.User != nil) {
|
||||
commentsJSON = append(commentsJSON, CommentJSON{Username: c.User.Username, UserID: int(c.User.ID), Content: util.MarkdownToHTML(c.Content), Date: c.CreatedAt.UTC()})
|
||||
} else {
|
||||
commentsJSON = append(commentsJSON, CommentJSON{})
|
||||
}
|
||||
}
|
||||
fileListJSON := make([]FileJSON, 0, len(t.FileList))
|
||||
for _, f := range t.FileList {
|
||||
|
|
|
@ -146,7 +146,7 @@ func getTorrentsOrderBy(parameters *serviceBase.WhereParams, orderBy string, lim
|
|||
if limit != 0 || offset != 0 { // if limits provided
|
||||
dbQuery = dbQuery + " LIMIT " + strconv.Itoa(limit) + " OFFSET " + strconv.Itoa(offset)
|
||||
}
|
||||
err = db.ORM.Raw(dbQuery, params...).Find(&torrents).Error
|
||||
err = db.ORM.Preload("Comments").Raw(dbQuery, params...).Find(&torrents).Error
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<a href="{{genRoute "view_torrent" "id" .ID }}">
|
||||
{{.Name}}
|
||||
</a>
|
||||
<span class="badge pull-right hidden-xs">{{ len .Comments }}</span>
|
||||
</td>
|
||||
<td class="hidden-xs"><b class="text-success">{{.Seeders}}</b></td>
|
||||
<td class="hidden-xs"><b class="text-danger">{{.Leechers}}</b></td>
|
||||
|
|
Référencer dans un nouveau ticket