From ac5112757ef0cd610cd8228aa39ec9c8ebe71636 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 4 Jul 2019 10:52:22 -0400 Subject: [PATCH] still allow viewing unpublic honks when logged in --- honk.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/honk.go b/honk.go index ef3c6a8..3027c7e 100644 --- a/honk.go +++ b/honk.go @@ -586,10 +586,20 @@ func showhonk(w http.ResponseWriter, r *http.Request) { xid := fmt.Sprintf("https://%s%s", serverName, r.URL.Path) h := getxonk(user.ID, xid) - if h == nil || !h.Public { + if h == nil { http.NotFound(w, r) return } + u := login.GetUserInfo(r) + if !h.Public { + if u == nil || u.UserID != h.UserID { + http.NotFound(w, r) + return + + } + honkpage(w, r, u, nil, []*Honk{h}, "one honk maybe more") + return + } if friendorfoe(r.Header.Get("Accept")) { donksforhonks([]*Honk{h}) _, j := jonkjonk(user, h) @@ -599,7 +609,6 @@ func showhonk(w http.ResponseWriter, r *http.Request) { return } honks := gethonksbyconvoy(-1, h.Convoy) - u := login.GetUserInfo(r) honkpage(w, r, u, nil, honks, "one honk maybe more") }