better handling of attachments during edit

This commit is contained in:
Ted Unangst 2019-09-17 10:44:00 -04:00
parent 49e944d8d2
commit aa0c99ae68
2 changed files with 6 additions and 0 deletions

View File

@ -713,6 +713,8 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
prev.Noise = xonk.Noise prev.Noise = xonk.Noise
prev.Precis = xonk.Precis prev.Precis = xonk.Precis
prev.Date = xonk.Date prev.Date = xonk.Date
prev.Donks = xonk.Donks
prev.Onts = xonk.Onts
updatehonk(prev) updatehonk(prev)
return nil return nil
} }

4
web.go
View File

@ -847,6 +847,7 @@ func edithonkpage(w http.ResponseWriter, r *http.Request) {
} }
honks := []*Honk{honk} honks := []*Honk{honk}
donksforhonks(honks)
reverbolate(u.UserID, honks) reverbolate(u.UserID, honks)
templinfo := getInfo(r) templinfo := getInfo(r)
templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r)
@ -854,6 +855,9 @@ func edithonkpage(w http.ResponseWriter, r *http.Request) {
templinfo["Noise"] = noise templinfo["Noise"] = noise
templinfo["ServerMessage"] = "honk edit" templinfo["ServerMessage"] = "honk edit"
templinfo["UpdateXID"] = honk.XID templinfo["UpdateXID"] = honk.XID
if len(honk.Donks) > 0 {
templinfo["SavedFile"] = honk.Donks[0].XID
}
err := readviews.Execute(w, "honkpage.html", templinfo) err := readviews.Execute(w, "honkpage.html", templinfo)
if err != nil { if err != nil {
log.Print(err) log.Print(err)