From d1f977154ff2cf7dbe53891f071c0c0307caa25b Mon Sep 17 00:00:00 2001 From: Azareal Date: Tue, 30 Jun 2020 12:27:04 +1000 Subject: [PATCH] guest profiles should not exist don't load profile resources on error --- routes/profile.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/routes/profile.go b/routes/profile.go index cfaf93e1..5d532a69 100644 --- a/routes/profile.go +++ b/routes/profile.go @@ -38,11 +38,8 @@ func ViewProfile(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Head if err != nil { return c.SimpleError(phrases.GetErrorPhrase("url_id_must_be_integer"), w, r, h) } - - // TODO: Preload this? - h.AddSheet(h.Theme.Name + "/profile.css") - if user.Loggedin { - h.AddScriptAsync("profile_member.js") + if pid == 0 { + return c.NotFound(w, r, h) } var puser *c.User @@ -61,6 +58,11 @@ func ViewProfile(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Head } h.Title = phrases.GetTitlePhrasef("profile", puser.Name) h.Path = c.BuildProfileURL(c.NameToSlug(puser.Name), puser.ID) + // TODO: Preload this? + h.AddSheet(h.Theme.Name + "/profile.css") + if user.Loggedin { + h.AddScriptAsync("profile_member.js") + } // Get the replies.. rows, err := profileStmts.getReplies.Query(puser.ID)