Skip to content

Commit 1267c9c

Browse files
fix: ensure reason present for workspace autoupdated notification (#17935)
Fixes #17930 Update the `WorkspaceAutoUpdated` notification to only display the reason if it is present.
1 parent 769c9ee commit 1267c9c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

coderd/autobuild/lifecycle_executor.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,18 @@ func (e *Executor) runOnce(t time.Time) Stats {
349349
nextBuildReason = string(nextBuild.Reason)
350350
}
351351

352+
templateVersionMessage := activeTemplateVersion.Message
353+
if templateVersionMessage == "" {
354+
templateVersionMessage = "None provided"
355+
}
356+
352357
if _, err := e.notificationsEnqueuer.Enqueue(e.ctx, ws.OwnerID, notifications.TemplateWorkspaceAutoUpdated,
353358
map[string]string{
354359
"name": ws.Name,
355360
"initiator": "autobuild",
356361
"reason": nextBuildReason,
357362
"template_version_name": activeTemplateVersion.Name,
358-
"template_version_message": activeTemplateVersion.Message,
363+
"template_version_message": templateVersionMessage,
359364
}, "autobuild",
360365
// Associate this notification with all the related entities.
361366
ws.ID, ws.OwnerID, ws.TemplateID, ws.OrganizationID,

0 commit comments

Comments
 (0)