commit cc6f6fa23c7a6315f9ad31f4625aa2932237531d
parent b0dbf47aa523b4853e305228c35b3e7b385a74fc
Author: Peter Kosyh <p.kosyh@gmail.com>
Date: Thu, 3 Sep 2020 22:42:56 +0300
redirect to topic
Diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/ii-node/web.go b/ii-node/web.go
@@ -328,7 +328,16 @@ func www_reply(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request, i
ii.Error.Printf("Error while store reply msg %s: %s", m.MsgId, err)
return err
}
- http.Redirect(w, r, "/" + m.Echo + "/1", http.StatusSeeOther)
+ var topic string
+ mi := www.db.Lookup(m.MsgId)
+ if mi == nil {
+ http.Redirect(w, r, "/" + m.MsgId + "/1", http.StatusSeeOther)
+ return nil
+ }
+ for p := mi; p != nil; p = getParent(www.db, p) {
+ topic = p.Id
+ }
+ http.Redirect(w, r, "/" + topic + "/-1", http.StatusSeeOther)
return nil
}
return nil