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:
Steven Masley
2025-08-06 11:45:07 -05:00
committed by GitHub
parent 5b80c47e8c
commit 3024bdebcb
4 changed files with 21 additions and 6 deletions
+2 -1
View File
@@ -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.",