#38 QA fix: render GetAttachmentForPaste in paste view; dedupe dark-toggle CSS
- renderPaste now looks up the paste's attachment and passes it as 'Attachment' so the paste.html attachment chip/image preview renders - remove duplicated .iconbtn.dark-toggle blocks (3x from stacked branches #127/#128) and duplicate mobile-media variants Verified: go vet + go test pass; live render on :18098 shows attachment-chip + img src=/f/id/name for a png upload (served 200 image/png) and chip-with-filename, no preview, for an html upload.
This commit is contained in:
@@ -215,6 +215,12 @@ func (h *Handlers) renderPaste(w http.ResponseWriter, row *store.PasteRow, justC
|
||||
lang = "text"
|
||||
}
|
||||
summary := fmt.Sprintf("%s · %s · %d views · %s", lang, humanSize(len(row.Content)), row.ViewCount, agoString(row.CreatedAt))
|
||||
// #38: one optional file attachment per paste; nil when none.
|
||||
attachment, err := h.Store.GetAttachmentForPaste(row.ID)
|
||||
if err != nil {
|
||||
http.Error(w, "db error", 500)
|
||||
return
|
||||
}
|
||||
data := map[string]any{
|
||||
"Page": "paste",
|
||||
"ID": row.ID,
|
||||
@@ -241,6 +247,7 @@ func (h *Handlers) renderPaste(w http.ResponseWriter, row *store.PasteRow, justC
|
||||
"ReadsLeftN": readsRemaining, // *int: reads remaining after this view
|
||||
"ReadsTotal": int(row.ReadsLimit.Int64),
|
||||
"JustCreated": justCreated,
|
||||
"Attachment": attachment,
|
||||
"Host": "this host",
|
||||
}
|
||||
h.renderPage(w, "paste.html", data)
|
||||
|
||||
Reference in New Issue
Block a user