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
+3 -3
View File
@@ -820,7 +820,7 @@ func TestTemplatesByOrganization(t *testing.T) {
client := coderdtest.New(t, nil)
owner := coderdtest.CreateFirstUser(t, client)
adminAlpha, adminAlphaData := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID, rbac.RoleTemplateAdmin())
adminBravo, adminBravoData := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID, rbac.RoleTemplateAdmin())
adminBravo, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID, rbac.RoleTemplateAdmin())
adminCharlie, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID, rbac.RoleTemplateAdmin())
versionA := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, nil)
@@ -847,8 +847,8 @@ func TestTemplatesByOrganization(t *testing.T) {
require.Equal(t, foo.ID, alpha[0].ID)
// List bravo
bravo, err := client.Templates(ctx, codersdk.TemplateFilter{
AuthorUsername: adminBravoData.Username,
bravo, err := adminBravo.Templates(ctx, codersdk.TemplateFilter{
AuthorUsername: codersdk.Me,
})
require.NoError(t, err)
require.Len(t, bravo, 1)