From 551876dd326c79db59de69bb6702242e9366556b Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Mon, 12 Jul 2021 23:00:53 +0500 Subject: [PATCH] Add lock and status to the search handlers --- web/search.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/search.go b/web/search.go index 842f3cb..3325af2 100644 --- a/web/search.go +++ b/web/search.go @@ -23,6 +23,10 @@ func handlerTitleSearch(w http.ResponseWriter, rq *http.Request) { query = rq.FormValue("q") u = user.FromRequest(rq) ) + if shown := u.ShowLockMaybe(w, rq); shown { + return + } + w.WriteHeader(http.StatusOK) _, _ = io.WriteString( w, views.BaseHTML( @@ -38,7 +42,12 @@ func handlerTitleSearchJSON(w http.ResponseWriter, rq *http.Request) { _ = rq.ParseForm() var ( query = rq.FormValue("q") + u = user.FromRequest(rq) ) + if shown := u.ShowLockMaybe(w, rq); shown { + return + } + w.WriteHeader(http.StatusOK) _, _ = io.WriteString( w, views.TitleSearchJSON(query, shroom.YieldHyphaNamesContainingString),