Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Fix the advanced search field showing up on user profile pages. Fixes #230.

Cette révision appartient à :
ripdog 2017-05-10 22:19:24 +12:00
Parent 36ecc052b1
révision 8391fc57bc

12
router/userHandler.go Fichier normal → Fichier exécutable
Voir le fichier

@ -64,7 +64,9 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
b := form.UserForm{} b := form.UserForm{}
modelHelper.BindValueForm(&b, r) modelHelper.BindValueForm(&b, r)
languages.SetTranslationFromRequest(viewProfileEditTemplate, r, "en-us") languages.SetTranslationFromRequest(viewProfileEditTemplate, r, "en-us")
htv := UserProfileEditVariables{&userProfile, b, form.NewErrors(), form.NewInfos(), NewSearchForm(), Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)} searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
htv := UserProfileEditVariables{&userProfile, b, form.NewErrors(), form.NewInfos(), searchForm, Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)}
err := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", htv) err := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil { if err != nil {
@ -77,7 +79,9 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
err["errors"] = append(err["errors"], errUser.Error()) err["errors"] = append(err["errors"], errUser.Error())
} }
languages.SetTranslationFromRequest(viewUserDeleteTemplate, r, "en-us") languages.SetTranslationFromRequest(viewUserDeleteTemplate, r, "en-us")
htv := UserVerifyTemplateVariables{err, NewSearchForm(), Navigation{}, GetUser(r), r.URL, mux.CurrentRoute(r)} searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
htv := UserVerifyTemplateVariables{err, searchForm, Navigation{}, GetUser(r), r.URL, mux.CurrentRoute(r)}
errorTmpl := viewUserDeleteTemplate.ExecuteTemplate(w, "index.html", htv) errorTmpl := viewUserDeleteTemplate.ExecuteTemplate(w, "index.html", htv)
if errorTmpl != nil { if errorTmpl != nil {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError) http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
@ -90,7 +94,9 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
if unfollow != nil { if unfollow != nil {
infosForm["infos"] = append(infosForm["infos"], fmt.Sprintf(T("user_unfollowed_msg"), userProfile.Username)) infosForm["infos"] = append(infosForm["infos"], fmt.Sprintf(T("user_unfollowed_msg"), userProfile.Username))
} }
htv := UserProfileVariables{&userProfile, infosForm, NewSearchForm(), Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)} searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
htv := UserProfileVariables{&userProfile, infosForm, searchForm, Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)}
err := viewProfileTemplate.ExecuteTemplate(w, "index.html", htv) err := viewProfileTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil { if err != nil {