fix: access to thread id in post template

This commit is contained in:
Yanislav Igonin 2022-02-03 15:12:34 +02:00
parent 6280a5fc9f
commit f4c2f9262e
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ type Post struct {
UpdatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"`
} }
func (p *Post) getThreadID() int { func (p Post) GetThreadID() int {
if p.IsParent { if p.IsParent {
return p.ID return p.ID
} }

View File

@ -5,8 +5,8 @@
<div class="files-container"> <div class="files-container">
{{ range $File := .Files }} {{ range $File := .Files }}
<div class="file-container"> <div class="file-container">
<a href="/uploads/{{.getThreadID}}/o/{{$File.ID}}.{{$File.Ext}}" target="blank"> <a href="/uploads/{{$.GetThreadID}}/o/{{$File.ID}}.{{$File.Ext}}" target="blank">
<img src="/uploads/{{.getThreadID}}/t/{{$File.ID}}.{{$File.Ext}}" class="file" alt="Uploaded picture"> <img src="/uploads/{{$.GetThreadID}}/t/{{$File.ID}}.{{$File.Ext}}" class="file" alt="Uploaded picture">
</a> </a>
</div> </div>
{{ end }} {{ end }}