Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Cette révision appartient à :
akuma06 2017-05-22 09:28:08 +02:00
Parent ced8f1ed87
révision efe6ea833a
2 fichiers modifiés avec 5 ajouts et 4 suppressions

Voir le fichier

@ -118,6 +118,7 @@ type ApiResultJSON struct {
type CommentJSON struct {
Username string `json:"username"`
UserID int `json:"user_id"`
UserAvatar string `json:"user_avatar"`
Content template.HTML `json:"content"`
Date time.Time `json:"date"`
}
@ -161,7 +162,7 @@ func (t *Torrent) ToJSON() TorrentJSON {
}
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()})
commentsJSON = append(commentsJSON, CommentJSON{Username: c.User.Username, UserID: int(c.User.ID), Content: util.MarkdownToHTML(c.Content), Date: c.CreatedAt.UTC(), UserAvatar: c.User.MD5})
} else {
commentsJSON = append(commentsJSON, CommentJSON{})
}

Voir le fichier

@ -30,7 +30,7 @@
{{ end }}
<br />
<h4 style="display:inline-block">
{{ call $.T "uploaded_by" }} <a href="{{ genRoute "user_profile" "id" ( print .Uploader.ID ) "username" .Uploader.Username }}">{{.UploaderName}}</a>
{{ call $.T "uploaded_by" }} <a href="{{ genRoute "user_profile" "id" ( print .UploaderID ) "username" (print .UploaderName) }}">{{.UploaderName}}</a>
</h4>
{{if ne .OldUploader ""}}
<span>({{.OldUploader}})</span>
@ -147,7 +147,7 @@
<li class="clearfix comment jumptarget" id="comment_{{inc $index}}">
{{/* The following line is wrong. Should be using the MD5 User hash but i don't knwo how to access it. */}}
{{/* Changing Gravatar for something else, so it can stay like this. */}}
<img src="https://www.gravatar.com/avatar/{{ .User.MD5 }}?s=50" class="avatar" alt="">
<img src="https://www.gravatar.com/avatar/{{ .UserAvatar }}?s=50" class="avatar" alt="">
<div class="commentBody">
<div class="commentData">
<div class="row">
@ -163,7 +163,7 @@
<a href="#comment_{{inc $index}}">#{{inc $index}}</a> by {{.Username}}
{{else}}
<a href="#comment_{{inc $index}}">#{{inc $index}}</a>
by <span class="break"><a href="{{ genRoute "user_profile" "id" ( print .User.ID ) "username" .User.Username }}">{{.Username}}</a></span>
by <span class="break"><a href="{{ genRoute "user_profile" "id" ( print .UserID ) "username" (print .Username) }}">{{.Username}}</a></span>
{{end}}
</div>
</div>