Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: allow update of empty template description#7225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Kira-Pilot merged 1 commit intomainfromupdate-template-desc/kira-pilot
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletionscli/templateedit_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -167,11 +167,13 @@ func TestTemplateEdit(t *testing.T) {

// Test the cli command.
displayName := "New Display Name 789"
description := "New Description ABC"
icon := "/icons/new-icon.png"
cmdArgs := []string{
"templates",
"edit",
template.Name,
"--description", description,
"--display-name", displayName,
"--icon", icon,
}
Expand All@@ -186,8 +188,8 @@ func TestTemplateEdit(t *testing.T) {
// Assert that the template metadata changed.
updated, err := client.Template(context.Background(), template.ID)
require.NoError(t, err)
assert.Equal(t, template.Name, updated.Name)// doesn't change
assert.Equal(t,initialDescription, updated.Description) // doesn't change
assert.Equal(t, template.Name, updated.Name) // doesn't change
assert.Equal(t,description, updated.Description)
assert.Equal(t, displayName, updated.DisplayName)
assert.Equal(t, icon, updated.Icon)
})
Expand DownExpand Up@@ -234,9 +236,9 @@ func TestTemplateEdit(t *testing.T) {
require.NoError(t, err)
// Properties don't change
assert.Equal(t, template.Name, updated.Name)
assert.Equal(t, template.Description, updated.Description)
// These properties are removed, as the API considers it as "delete" request
// See: https://github.com/coder/coder/issues/5066
assert.Equal(t, "", updated.Description)
assert.Equal(t, "", updated.Icon)
assert.Equal(t, "", updated.DisplayName)
})
Expand Down
5 changes: 2 additions & 3 deletionscoderd/coderdtest/coderdtest.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -591,9 +591,8 @@ func CreateWorkspaceBuild(
// compatibility with testing. The name assigned is randomly generated.
func CreateTemplate(t *testing.T, client *codersdk.Client, organization uuid.UUID, version uuid.UUID, mutators ...func(*codersdk.CreateTemplateRequest)) codersdk.Template {
req := codersdk.CreateTemplateRequest{
Name: randomUsername(t),
Description: randomUsername(t),
VersionID: version,
Name: randomUsername(t),
VersionID: version,
}
for _, mut := range mutators {
mut(&req)
Expand Down
7 changes: 2 additions & 5 deletionscoderd/templates.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -493,8 +493,8 @@ func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) {
}

// Update template metadata -- empty fields are not overwritten,
// except for display_name, icon, and default_ttl.
//The exception is required to clear content of these fields with UI.
// except for display_name,description,icon, and default_ttl.
//These exceptions are required to clear content of these fields with UI.
name := req.Name
displayName := req.DisplayName
desc := req.Description
Expand All@@ -503,9 +503,6 @@ func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) {
if name == "" {
name = template.Name
}
if desc == "" {
desc = template.Description
}

var err error
updated, err = tx.UpdateTemplateMetaByID(ctx, database.UpdateTemplateMetaByIDParams{
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp