mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: support 'me' as the username for template author (#19204)
`author:me` to find my templates. Much nicer than knowing my own username
This commit is contained in:
+2
-1
@@ -544,9 +544,10 @@ func (api *API) templatesByOrganization() http.HandlerFunc {
|
||||
func (api *API) fetchTemplates(mutate func(r *http.Request, arg *database.GetTemplatesWithFilterParams)) http.HandlerFunc {
|
||||
return func(rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
key := httpmw.APIKey(r)
|
||||
|
||||
queryStr := r.URL.Query().Get("q")
|
||||
filter, errs := searchquery.Templates(ctx, api.Database, queryStr)
|
||||
filter, errs := searchquery.Templates(ctx, api.Database, key.UserID, queryStr)
|
||||
if len(errs) > 0 {
|
||||
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
|
||||
Message: "Invalid template search query.",
|
||||
|
||||
Reference in New Issue
Block a user