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: ensure reason present for workspace autoupdated notification#17935

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
DanielleMaywood merged 2 commits intomainfromdm-update-reason-notif
May 20, 2025

Conversation

DanielleMaywood
Copy link
Contributor

Fixes#17930

Update theWorkspaceAutoUpdated notification to only display the reason if it is present.

…autoupdatedFixes#17930Update the `WorkspaceAutoUpdated` notification to only display thereason if it is present.
@DanielleMaywoodDanielleMaywood changed the titlefix(coderd/notifications): only show reason if present for workspace autoupdatedfix(coderd/notifications): omit reason if empty for workspace autoupdatedMay 20, 2025
@DanielleMaywoodDanielleMaywood marked this pull request as ready for reviewMay 20, 2025 11:28
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR updates the WorkspaceAutoUpdated notification to suppress the “Reason for update” block when no reason is provided.

  • Adds golden fixtures for both webhook and SMTP outputs when.Labels.template_version_message is empty
  • Introduces a conditional in the SQL migration to append the reason only if present
  • Adds a new test case to verify rendering when no message is provided

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
coderd/notifications/testdata/rendered-templates/webhook/TemplateWorkspaceAutoUpdated_NoMessage.json.goldenNew JSON fixture showing no reason block
coderd/notifications/testdata/rendered-templates/smtp/TemplateWorkspaceAutoUpdated_NoMessage.html.goldenNew HTML fixture showing no reason block
coderd/notifications/notifications_test.goAddedTemplateWorkspaceAutoUpdated_NoMessage test case
coderd/database/migrations/000328_fix_workspace_update_reason.up.sqlUpdatedbody_template to conditionally include the reason block
coderd/database/migrations/000328_fix_workspace_update_reason.down.sqlRestores original template with unconditional reason block
Comments suppressed due to low confidence (1)

coderd/notifications/notifications_test.go:849

  • Consider adding a complementary test case wheretemplate_version_message is non-empty to verify that the reason block renders correctly under the conditional.
name: "TemplateWorkspaceAutoUpdated_NoMessage",

@@ -0,0 +1,4 @@
UPDATE notification_templates
SET body_template = E'Your workspace **{{.Labels.name}}** has been updated automatically to the latest template version ({{.Labels.template_version_name}}).' ||
E'{{if .Labels.template_version_message}}\n\nReason for update: **{{.Labels.template_version_message}}**.{{end}}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Would it not be easier to inject a default non-empty value for the reason instead of excluding it?
As a receiver of this notification, if I see this reason sometimes but not other times then it'll be confusing.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Something like "No reason given"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That could work, although I think it'd be good to find out why we don't specify a reason.

Copy link
Member

@ethanndicksonethanndicksonMay 20, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

maybe justNone /None provided?

Copy link
ContributorAuthor

@DanielleMaywoodDanielleMaywoodMay 20, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That could work, although I think it'd be good to find out why we don't specify a reason.

When making a new template version, if there is no message specified in the optional field, then this field will end up empty on a workspace auto update.

I'll go with@ethanndickson's suggestion ofNone provided.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If that's the case, "template version updated" would make more sense than "none provided", no?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd assume "template version updated" is implied by the prior part of the notification, so I feel like we don't need to repeat that.

Your workspace{{.Labels.name}} has been updated automatically to the latest template version ({{.Labels.template_version_name}}).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

OK 👍

@DanielleMaywood
Copy link
ContributorAuthor

I've updated the PR to conditionally check the argument provided to the template instead of making a change to the template itself.

@DanielleMaywoodDanielleMaywood changed the titlefix(coderd/notifications): omit reason if empty for workspace autoupdated fix: ensure reason present for workspace autoupdated notificationMay 20, 2025
@DanielleMaywoodDanielleMaywood changed the title fix: ensure reason present for workspace autoupdated notificationfix: ensure reason present for workspace autoupdated notificationMay 20, 2025
Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

@DanielleMaywoodDanielleMaywood merged commit1267c9c intomainMay 20, 2025
38 checks passed
@DanielleMaywoodDanielleMaywood deleted the dm-update-reason-notif branchMay 20, 2025 15:01
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 20, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

Copilot code reviewCopilotCopilot left review comments

@dannykoppingdannykoppingdannykopping approved these changes

@ethanndicksonethanndicksonAwaiting requested review from ethanndickson

Assignees

@DanielleMaywoodDanielleMaywood

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

bug: Workspace update notifications with an empty template version message aren't handled
3 participants
@DanielleMaywood@dannykopping@ethanndickson

[8]ページ先頭

©2009-2025 Movatter.jp