Skip to content

fix: fix dormancy notifications #14029

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jul 29, 2024
Merged

fix: fix dormancy notifications #14029

merged 16 commits into from
Jul 29, 2024

Conversation

BrunoQuaresma
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma commented Jul 26, 2024

Dormancy templates have been updated for better readability

var bodyTmpl string
err := sql.
QueryRow("SELECT body_template FROM notification_templates WHERE id = $1 LIMIT 1", tc.id).
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've inlined this query because it's only used for tests now. I don't think the overhead of adding a new SQLC query would be justifiable. I actually tried that, and I encountered a few accounting errors because the query wasn't being used in the non-test codebase.


if _, err := s.NotificationsEnqueuer.Enqueue(ctx, workspace.OwnerID, notifications.TemplateWorkspaceAutobuildFailed,
map[string]string{
"name": workspace.Name,
"initiator": initiator,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I found out that TemplateWorkspaceAutobuildFailed was not using the initiator label in the template body so I just removed it.

@BrunoQuaresma
Copy link
Collaborator Author

Unfortunately, those tests don't prevent wrong labels from being used or required labels from being missed. To make that happen, the notifications tests would have to use the database. I think it would be valid but not in the scope for this PR.

@BrunoQuaresma BrunoQuaresma marked this pull request as ready for review July 26, 2024 18:44
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

We need a bit more attention to detail here please.
I think we should look into your idea of golden files for these email templates; we're missing too many mistakes without them. Could you add an issue for that?

BrunoQuaresma and others added 7 commits July 29, 2024 10:12
Co-authored-by: Danny Kopping <danny@coder.com>
Co-authored-by: Danny Kopping <danny@coder.com>
Co-authored-by: Danny Kopping <danny@coder.com>
Co-authored-by: Danny Kopping <danny@coder.com>
@BrunoQuaresma
Copy link
Collaborator Author

Issue created for tests: coder/internal#32

Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

Almost there!
I don't need to re-review once you've address the one remaining comment
Thanks @BrunoQuaresma

@BrunoQuaresma BrunoQuaresma merged commit 58b810f into main Jul 29, 2024
29 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/fix-dormancy-template branch July 29, 2024 14:20
@github-actions github-actions bot locked and limited conversation to collaborators Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reword the dormant template notification
2 participants