mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
fix: allow update of empty template description (#7225)
This commit is contained in:
@@ -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)
|
||||
|
||||
+2
-5
@@ -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
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user