-
Notifications
You must be signed in to change notification settings - Fork 937
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
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
630dd87
Test notification templates and update them
BrunoQuaresma a6bcef9
Fix lint
BrunoQuaresma 97514f5
Fix SQL
BrunoQuaresma 4b75dcf
Fix workspace test
BrunoQuaresma 008a410
Fix lint
BrunoQuaresma 799644e
Fix tests
BrunoQuaresma 34f8aa4
Fix test
BrunoQuaresma 5da3745
Remove sqlc query in favor of inline sql for tests
BrunoQuaresma 7bdce48
Update coderd/workspaces.go
BrunoQuaresma fc055c8
Update coderd/autobuild/lifecycle_executor.go
BrunoQuaresma 9490792
Update coderd/autobuild/lifecycle_executor.go
BrunoQuaresma cb1ca3b
Update coderd/autobuild/lifecycle_executor.go
BrunoQuaresma de1d381
Merge branch 'main' of https://github.com/coder/coder into bq/fix-dor…
BrunoQuaresma e7557d2
Apply Dannys suggestion
BrunoQuaresma 886a482
Merge branch 'bq/fix-dormancy-template' of https://github.com/coder/c…
BrunoQuaresma ab344b3
Verify if body and title are not empty
BrunoQuaresma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
16 changes: 16 additions & 0 deletions
16
coderd/database/migrations/000232_update_dormancy_notification_template.up.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}}\n\n' || | ||
E'Your workspace **{{.Labels.name}}** has been marked as [**dormant**](https://coder.com/docs/templates/schedule#dormancy-threshold-enterprise) because of {{.Labels.reason}}.\n' || | ||
E'Dormant workspaces are [automatically deleted](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) after {{.Labels.timeTilDormant}} of inactivity.\n' || | ||
E'To prevent deletion, use your workspace with the link below.' | ||
WHERE | ||
id = '0ea69165-ec14-4314-91f1-69566ac3c5a0'; | ||
|
||
UPDATE notification_templates | ||
SET | ||
body_template = E'Hi {{.UserName}}\n\n' || | ||
E'Your workspace **{{.Labels.name}}** has been marked for **deletion** after {{.Labels.timeTilDormant}} of [dormancy](https://coder.com/docs/templates/schedule#dormancy-auto-deletion-enterprise) because of {{.Labels.reason}}.\n' || | ||
E'To prevent deletion, use your workspace with the link below.' | ||
WHERE | ||
id = '51ce2fdf-c9ca-4be1-8d70-628674f9bc42'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1101,13 +1101,11 @@ func (s *server) notifyWorkspaceBuildFailed(ctx context.Context, workspace datab | |
return // failed workspace build initiated by a user should not notify | ||
} | ||
reason = string(build.Reason) | ||
initiator := "autobuild" | ||
|
||
if _, err := s.NotificationsEnqueuer.Enqueue(ctx, workspace.OwnerID, notifications.TemplateWorkspaceAutobuildFailed, | ||
map[string]string{ | ||
"name": workspace.Name, | ||
"initiator": initiator, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found out that |
||
"reason": reason, | ||
"name": workspace.Name, | ||
"reason": reason, | ||
}, "provisionerdserver", | ||
// Associate this notification with all the related entities. | ||
workspace.ID, workspace.OwnerID, workspace.TemplateID, workspace.OrganizationID, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.