still allow viewing unpublic honks when logged in

This commit is contained in:
Ted Unangst 2019-07-04 10:52:22 -04:00
parent 4eeb9ec743
commit ac5112757e
1 changed files with 11 additions and 2 deletions

13
honk.go
View File

@ -586,10 +586,20 @@ func showhonk(w http.ResponseWriter, r *http.Request) {
xid := fmt.Sprintf("https://%s%s", serverName, r.URL.Path) xid := fmt.Sprintf("https://%s%s", serverName, r.URL.Path)
h := getxonk(user.ID, xid) h := getxonk(user.ID, xid)
if h == nil || !h.Public { if h == nil {
http.NotFound(w, r) http.NotFound(w, r)
return 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")) { if friendorfoe(r.Header.Get("Accept")) {
donksforhonks([]*Honk{h}) donksforhonks([]*Honk{h})
_, j := jonkjonk(user, h) _, j := jonkjonk(user, h)
@ -599,7 +609,6 @@ func showhonk(w http.ResponseWriter, r *http.Request) {
return return
} }
honks := gethonksbyconvoy(-1, h.Convoy) honks := gethonksbyconvoy(-1, h.Convoy)
u := login.GetUserInfo(r)
honkpage(w, r, u, nil, honks, "one honk maybe more") honkpage(w, r, u, nil, honks, "one honk maybe more")
} }