mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
Rollback https://github.com/coder/coder/pull/18081
This commit is contained in:
4
coderd/apidoc/docs.go
generated
4
coderd/apidoc/docs.go
generated
@ -17019,9 +17019,7 @@ const docTemplate = `{
|
||||
"format": "uuid"
|
||||
},
|
||||
"owner_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"owner_username": {
|
||||
"description": "OwnerName is the username of the owner of the workspace.",
|
||||
"type": "string"
|
||||
},
|
||||
"template_active_version_id": {
|
||||
|
4
coderd/apidoc/swagger.json
generated
4
coderd/apidoc/swagger.json
generated
@ -15524,9 +15524,7 @@
|
||||
"format": "uuid"
|
||||
},
|
||||
"owner_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"owner_username": {
|
||||
"description": "OwnerName is the username of the owner of the workspace.",
|
||||
"type": "string"
|
||||
},
|
||||
"template_active_version_id": {
|
||||
|
@ -462,7 +462,7 @@ func (api *API) auditLogResourceLink(ctx context.Context, alog database.GetAudit
|
||||
if getWorkspaceErr != nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("/@%s/%s", workspace.OwnerUsername, workspace.Name)
|
||||
return fmt.Sprintf("/@%s/%s", workspace.OwnerName, workspace.Name)
|
||||
|
||||
case database.ResourceTypeWorkspaceApp:
|
||||
if additionalFields.WorkspaceOwner != "" && additionalFields.WorkspaceName != "" {
|
||||
@ -472,7 +472,7 @@ func (api *API) auditLogResourceLink(ctx context.Context, alog database.GetAudit
|
||||
if getWorkspaceErr != nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("/@%s/%s", workspace.OwnerUsername, workspace.Name)
|
||||
return fmt.Sprintf("/@%s/%s", workspace.OwnerName, workspace.Name)
|
||||
|
||||
case database.ResourceTypeOauth2ProviderApp:
|
||||
return fmt.Sprintf("/deployment/oauth2-provider/apps/%s", alog.AuditLog.ResourceID)
|
||||
|
@ -139,7 +139,7 @@ func TestAuditLogs(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
buildNumberString := strconv.FormatInt(int64(workspace.LatestBuild.BuildNumber), 10)
|
||||
require.Equal(t, auditLogs.AuditLogs[0].ResourceLink, fmt.Sprintf("/@%s/%s/builds/%s",
|
||||
workspace.OwnerUsername, workspace.Name, buildNumberString))
|
||||
workspace.OwnerName, workspace.Name, buildNumberString))
|
||||
})
|
||||
|
||||
t.Run("Organization", func(t *testing.T) {
|
||||
|
@ -1771,7 +1771,7 @@ func TestWorkspaceAgent_Metadata(t *testing.T) {
|
||||
|
||||
// Verify manifest API response.
|
||||
require.Equal(t, workspace.ID, manifest.WorkspaceID)
|
||||
require.Equal(t, workspace.OwnerUsername, manifest.OwnerUsername)
|
||||
require.Equal(t, workspace.OwnerName, manifest.OwnerName)
|
||||
require.Equal(t, "First Meta", manifest.Metadata[0].DisplayName)
|
||||
require.Equal(t, "foo1", manifest.Metadata[0].Key)
|
||||
require.Equal(t, "echo hi", manifest.Metadata[0].Script)
|
||||
|
@ -2248,8 +2248,7 @@ func convertWorkspace(
|
||||
CreatedAt: workspace.CreatedAt,
|
||||
UpdatedAt: workspace.UpdatedAt,
|
||||
OwnerID: workspace.OwnerID,
|
||||
OwnerName: workspace.OwnerName,
|
||||
OwnerUsername: workspace.OwnerUsername,
|
||||
OwnerName: workspace.OwnerUsername,
|
||||
OwnerAvatarURL: workspace.OwnerAvatarUrl,
|
||||
OrganizationID: workspace.OrganizationID,
|
||||
OrganizationName: workspace.OrganizationName,
|
||||
|
@ -1380,12 +1380,12 @@ func TestWorkspaceByOwnerAndName(t *testing.T) {
|
||||
|
||||
// Then:
|
||||
// When we call without includes_deleted, we don't expect to get the workspace back
|
||||
_, err = client.WorkspaceByOwnerAndName(ctx, workspace.OwnerUsername, workspace.Name, codersdk.WorkspaceOptions{})
|
||||
_, err = client.WorkspaceByOwnerAndName(ctx, workspace.OwnerName, workspace.Name, codersdk.WorkspaceOptions{})
|
||||
require.ErrorContains(t, err, "404")
|
||||
|
||||
// Then:
|
||||
// When we call with includes_deleted, we should get the workspace back
|
||||
workspaceNew, err := client.WorkspaceByOwnerAndName(ctx, workspace.OwnerUsername, workspace.Name, codersdk.WorkspaceOptions{IncludeDeleted: true})
|
||||
workspaceNew, err := client.WorkspaceByOwnerAndName(ctx, workspace.OwnerName, workspace.Name, codersdk.WorkspaceOptions{IncludeDeleted: true})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, workspace.ID, workspaceNew.ID)
|
||||
|
||||
@ -1403,7 +1403,7 @@ func TestWorkspaceByOwnerAndName(t *testing.T) {
|
||||
|
||||
// Then:
|
||||
// We can fetch the most recent workspace
|
||||
workspaceNew, err = client.WorkspaceByOwnerAndName(ctx, workspace.OwnerUsername, workspace.Name, codersdk.WorkspaceOptions{})
|
||||
workspaceNew, err = client.WorkspaceByOwnerAndName(ctx, workspace.OwnerName, workspace.Name, codersdk.WorkspaceOptions{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, workspace.ID, workspaceNew.ID)
|
||||
|
||||
@ -1417,7 +1417,7 @@ func TestWorkspaceByOwnerAndName(t *testing.T) {
|
||||
|
||||
// Then:
|
||||
// When we fetch the deleted workspace, we get the most recently deleted one
|
||||
workspaceNew, err = client.WorkspaceByOwnerAndName(ctx, workspace.OwnerUsername, workspace.Name, codersdk.WorkspaceOptions{IncludeDeleted: true})
|
||||
workspaceNew, err = client.WorkspaceByOwnerAndName(ctx, workspace.OwnerName, workspace.Name, codersdk.WorkspaceOptions{IncludeDeleted: true})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, workspace.ID, workspaceNew.ID)
|
||||
})
|
||||
@ -1902,7 +1902,7 @@ func TestWorkspaceFilterManual(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Workspaces, len(workspaces))
|
||||
for _, found := range res.Workspaces {
|
||||
require.Equal(t, found.OwnerUsername, sdkUser.Username)
|
||||
require.Equal(t, found.OwnerName, sdkUser.Username)
|
||||
}
|
||||
})
|
||||
t.Run("IDs", func(t *testing.T) {
|
||||
@ -2034,7 +2034,7 @@ func TestWorkspaceFilterManual(t *testing.T) {
|
||||
|
||||
// single workspace
|
||||
res, err := client.Workspaces(ctx, codersdk.WorkspaceFilter{
|
||||
FilterQuery: fmt.Sprintf("template:%s %s/%s", template.Name, workspace.OwnerUsername, workspace.Name),
|
||||
FilterQuery: fmt.Sprintf("template:%s %s/%s", template.Name, workspace.OwnerName, workspace.Name),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res.Workspaces, 1)
|
||||
|
Reference in New Issue
Block a user