-
Notifications
You must be signed in to change notification settings - Fork 894
feat(coderd): remove greetings from notifications templates #16991
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 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d98a199
work on removing greetings from templates
defelmnq e4966e2
regenerate golden files
defelmnq 359884a
give it another try
defelmnq 9ce82de
wokr on golden files
defelmnq 7914983
regenerate golden-files
defelmnq ddc4e70
improve templates for smtp
defelmnq 672e4c5
work on golden-files
defelmnq 0563f7e
fix golden-files
defelmnq f96ba19
up context wait
defelmnq a844284
work on greetings
defelmnq dcc6a25
add missing templates
defelmnq e00dcc0
update golden files to remove extra br
defelmnq 3a49b58
revert test
defelmnq aa6107c
Change username to name
defelmnq 1c9b5cb
Merge remote-tracking branch 'origin/main' into coder-inbox/internal-448
defelmnq 5c52ec4
rename migration
defelmnq f882bea
add changes in plaintext
defelmnq dcd47bb
add changes in plaintext
defelmnq d775d6a
remove final newline
defelmnq 71adf82
remove final newline on plaintext
defelmnq ca9369b
change tabs to spaces
defelmnq 5f6c424
Merge remote-tracking branch 'origin/main' into coder-inbox/internal-448
defelmnq 916b777
change migration number
defelmnq 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
69 changes: 69 additions & 0 deletions
69
coderd/database/migrations/000303_remove_greetings_notifications_templates.down.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,69 @@ | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'Your workspace **{{.Labels.name}}** was deleted.\n\n' || | ||
E'The specified reason was "**{{.Labels.reason}}{{ if .Labels.initiator }} ({{ .Labels.initiator }}){{end}}**".' WHERE id = 'f517da0b-cdc9-410f-ab89-a86107c420ed'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'Automatic build of your workspace **{{.Labels.name}}** failed.\n\n' || | ||
E'The specified reason was "**{{.Labels.reason}}**".' WHERE id = '381df2a9-c0c0-4749-420f-80a9280c66f9'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'Your workspace **{{.Labels.name}}** has been updated automatically to the latest template version ({{.Labels.template_version_name}}).\n\n' || | ||
E'Reason for update: **{{.Labels.template_version_message}}**.' WHERE id = 'c34a0c09-0704-4cac-bd1c-0c0146811c2b'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'New user account **{{.Labels.created_account_name}}** has been created.\n\n' || | ||
E'This new user account was created {{if .Labels.created_account_user_name}}for **{{.Labels.created_account_user_name}}** {{end}}by **{{.Labels.initiator}}**.' WHERE id = '4e19c0ac-94e1-4532-9515-d1801aa283b2'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'User account **{{.Labels.deleted_account_name}}** has been deleted.\n\n' || | ||
E'The deleted account {{if .Labels.deleted_account_user_name}}belonged to **{{.Labels.deleted_account_user_name}}** and {{end}}was deleted by **{{.Labels.initiator}}**.' WHERE id = 'f44d9314-ad03-4bc8-95d0-5cad491da6b6'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'User account **{{.Labels.suspended_account_name}}** has been suspended.\n\n' || | ||
E'The account {{if .Labels.suspended_account_user_name}}belongs to **{{.Labels.suspended_account_user_name}}** and it {{end}}was suspended by **{{.Labels.initiator}}**.' WHERE id = 'b02ddd82-4733-4d02-a2d7-c36f3598997d'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'Your account **{{.Labels.suspended_account_name}}** has been suspended by **{{.Labels.initiator}}**.' WHERE id = '6a2f0609-9b69-4d36-a989-9f5925b6cbff'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'User account **{{.Labels.activated_account_name}}** has been activated.\n\n' || | ||
E'The account {{if .Labels.activated_account_user_name}}belongs to **{{.Labels.activated_account_user_name}}** and it {{ end }}was activated by **{{.Labels.initiator}}**.' WHERE id = '9f5af851-8408-4e73-a7a1-c6502ba46689'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'Your account **{{.Labels.activated_account_name}}** has been activated by **{{.Labels.initiator}}**.' WHERE id = '1a6a6bea-ee0a-43e2-9e7c-eabdb53730e4'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\nA manual build of the workspace **{{.Labels.name}}** using the template **{{.Labels.template_name}}** failed (version: **{{.Labels.template_version_name}}**).\nThe workspace build was initiated by **{{.Labels.initiator}}**.' WHERE id = '2faeee0f-26cb-4e96-821c-85ccb9f71513'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}}, | ||
|
||
Template **{{.Labels.template_display_name}}** has failed to build {{.Data.failed_builds}}/{{.Data.total_builds}} times over the last {{.Data.report_frequency}}. | ||
|
||
**Report:** | ||
{{range $version := .Data.template_versions}} | ||
**{{$version.template_version_name}}** failed {{$version.failed_count}} time{{if gt $version.failed_count 1.0}}s{{end}}: | ||
{{range $build := $version.failed_builds}} | ||
* [{{$build.workspace_owner_username}} / {{$build.workspace_name}} / #{{$build.build_number}}]({{base_url}}/@{{$build.workspace_owner_username}}/{{$build.workspace_name}}/builds/{{$build.build_number}}) | ||
{{- end}} | ||
{{end}} | ||
We recommend reviewing these issues to ensure future builds are successful.' WHERE id = '34a20db2-e9cc-4a93-b0e4-8569699d7a00'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\nUse the link below to reset your password.\n\nIf you did not make this request, you can ignore this message.' WHERE id = '62f86a30-2330-4b61-a26d-311ff3b608cf'; | ||
UPDATE notification_templates SET body_template = E'Hello {{.UserName}},\n\n'|| | ||
E'The template **{{.Labels.template}}** has been deprecated with the following message:\n\n' || | ||
E'**{{.Labels.message}}**\n\n' || | ||
E'New workspaces may not be created from this template. Existing workspaces will continue to function normally.' WHERE id = 'f40fae84-55a2-42cd-99fa-b41c1ca64894'; | ||
UPDATE notification_templates SET body_template = E'Hello {{.UserName}},\n\n'|| | ||
E'The workspace **{{.Labels.workspace}}** has been created from the template **{{.Labels.template}}** using version **{{.Labels.version}}**.' WHERE id = '281fdf73-c6d6-4cbb-8ff5-888baf8a2fff'; | ||
UPDATE notification_templates SET body_template = E'Hello {{.UserName}},\n\n'|| | ||
E'A new workspace build has been manually created for your workspace **{{.Labels.workspace}}** by **{{.Labels.initiator}}** to update it to version **{{.Labels.version}}** of template **{{.Labels.template}}**.' WHERE id = 'd089fe7b-d5c5-4c0c-aaf5-689859f7d392'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n'|| | ||
E'Your workspace **{{.Labels.workspace}}** has reached the memory usage threshold set at **{{.Labels.threshold}}**.' WHERE id = 'a9d027b4-ac49-4fb1-9f6d-45af15f64e7a'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n'|| | ||
E'{{ if eq (len .Data.volumes) 1 }}{{ $volume := index .Data.volumes 0 }}'|| | ||
E'Volume **`{{$volume.path}}`** is over {{$volume.threshold}} full in workspace **{{.Labels.workspace}}**.'|| | ||
E'{{ else }}'|| | ||
E'The following volumes are nearly full in workspace **{{.Labels.workspace}}**\n\n'|| | ||
E'{{ range $volume := .Data.volumes }}'|| | ||
E'- **`{{$volume.path}}`** is over {{$volume.threshold}} full\n'|| | ||
E'{{ end }}'|| | ||
E'{{ end }}' WHERE id = 'f047f6a3-5713-40f7-85aa-0394cce9fa3a'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n'|| | ||
E'This is a test notification.' WHERE id = 'c425f63e-716a-4bf4-ae24-78348f706c3f'; | ||
UPDATE notification_templates SET body_template = E'Hi {{.UserName}},\n\n' || | ||
E'The template **{{.Labels.name}}** was deleted by **{{ .Labels.initiator }}**.\n\n' WHERE id = '29a09665-2a4c-403f-9648-54301670e7be'; | ||
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'; |
49 changes: 49 additions & 0 deletions
49
coderd/database/migrations/000303_remove_greetings_notifications_templates.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,49 @@ | ||
UPDATE notification_templates SET body_template = E'Your workspace **{{.Labels.name}}** was deleted.\n\n' || | ||
E'The specified reason was "**{{.Labels.reason}}{{ if .Labels.initiator }} ({{ .Labels.initiator }}){{end}}**".' WHERE id = 'f517da0b-cdc9-410f-ab89-a86107c420ed'; | ||
UPDATE notification_templates SET body_template = E'Automatic build of your workspace **{{.Labels.name}}** failed.\n\n' || | ||
E'The specified reason was "**{{.Labels.reason}}**".' WHERE id = '381df2a9-c0c0-4749-420f-80a9280c66f9'; | ||
UPDATE notification_templates SET body_template = E'Your workspace **{{.Labels.name}}** has been updated automatically to the latest template version ({{.Labels.template_version_name}}).\n\n' || | ||
E'Reason for update: **{{.Labels.template_version_message}}**.' WHERE id = 'c34a0c09-0704-4cac-bd1c-0c0146811c2b'; | ||
UPDATE notification_templates SET body_template = E'New user account **{{.Labels.created_account_name}}** has been created.\n\n' || | ||
E'This new user account was created {{if .Labels.created_account_user_name}}for **{{.Labels.created_account_user_name}}** {{end}}by **{{.Labels.initiator}}**.' WHERE id = '4e19c0ac-94e1-4532-9515-d1801aa283b2'; | ||
UPDATE notification_templates SET body_template = E'User account **{{.Labels.deleted_account_name}}** has been deleted.\n\n' || | ||
E'The deleted account {{if .Labels.deleted_account_user_name}}belonged to **{{.Labels.deleted_account_user_name}}** and {{end}}was deleted by **{{.Labels.initiator}}**.' WHERE id = 'f44d9314-ad03-4bc8-95d0-5cad491da6b6'; | ||
UPDATE notification_templates SET body_template = E'User account **{{.Labels.suspended_account_name}}** has been suspended.\n\n' || | ||
E'The account {{if .Labels.suspended_account_user_name}}belongs to **{{.Labels.suspended_account_user_name}}** and it {{end}}was suspended by **{{.Labels.initiator}}**.' WHERE id = 'b02ddd82-4733-4d02-a2d7-c36f3598997d'; | ||
UPDATE notification_templates SET body_template = E'Your account **{{.Labels.suspended_account_name}}** has been suspended by **{{.Labels.initiator}}**.' WHERE id = '6a2f0609-9b69-4d36-a989-9f5925b6cbff'; | ||
UPDATE notification_templates SET body_template = E'User account **{{.Labels.activated_account_name}}** has been activated.\n\n' || | ||
E'The account {{if .Labels.activated_account_user_name}}belongs to **{{.Labels.activated_account_user_name}}** and it {{ end }}was activated by **{{.Labels.initiator}}**.' WHERE id = '9f5af851-8408-4e73-a7a1-c6502ba46689'; | ||
UPDATE notification_templates SET body_template = E'Your account **{{.Labels.activated_account_name}}** has been activated by **{{.Labels.initiator}}**.' WHERE id = '1a6a6bea-ee0a-43e2-9e7c-eabdb53730e4'; | ||
UPDATE notification_templates SET body_template = E'A manual build of the workspace **{{.Labels.name}}** using the template **{{.Labels.template_name}}** failed (version: **{{.Labels.template_version_name}}**).\nThe workspace build was initiated by **{{.Labels.initiator}}**.' WHERE id = '2faeee0f-26cb-4e96-821c-85ccb9f71513'; | ||
UPDATE notification_templates SET body_template = E'Template **{{.Labels.template_display_name}}** has failed to build {{.Data.failed_builds}}/{{.Data.total_builds}} times over the last {{.Data.report_frequency}}. | ||
|
||
**Report:** | ||
{{range $version := .Data.template_versions}} | ||
**{{$version.template_version_name}}** failed {{$version.failed_count}} time{{if gt $version.failed_count 1.0}}s{{end}}: | ||
{{range $build := $version.failed_builds}} | ||
* [{{$build.workspace_owner_username}} / {{$build.workspace_name}} / #{{$build.build_number}}]({{base_url}}/@{{$build.workspace_owner_username}}/{{$build.workspace_name}}/builds/{{$build.build_number}}) | ||
{{- end}} | ||
{{end}} | ||
We recommend reviewing these issues to ensure future builds are successful.' WHERE id = '34a20db2-e9cc-4a93-b0e4-8569699d7a00'; | ||
UPDATE notification_templates SET body_template = E'Use the link below to reset your password.\n\nIf you did not make this request, you can ignore this message.' WHERE id = '62f86a30-2330-4b61-a26d-311ff3b608cf'; | ||
UPDATE notification_templates SET body_template = E'The template **{{.Labels.template}}** has been deprecated with the following message:\n\n' || | ||
E'**{{.Labels.message}}**\n\n' || | ||
E'New workspaces may not be created from this template. Existing workspaces will continue to function normally.' WHERE id = 'f40fae84-55a2-42cd-99fa-b41c1ca64894'; | ||
UPDATE notification_templates SET body_template = E'The workspace **{{.Labels.workspace}}** has been created from the template **{{.Labels.template}}** using version **{{.Labels.version}}**.' WHERE id = '281fdf73-c6d6-4cbb-8ff5-888baf8a2fff'; | ||
UPDATE notification_templates SET body_template = E'A new workspace build has been manually created for your workspace **{{.Labels.workspace}}** by **{{.Labels.initiator}}** to update it to version **{{.Labels.version}}** of template **{{.Labels.template}}**.' WHERE id = 'd089fe7b-d5c5-4c0c-aaf5-689859f7d392'; | ||
UPDATE notification_templates SET body_template = E'Your workspace **{{.Labels.workspace}}** has reached the memory usage threshold set at **{{.Labels.threshold}}**.' WHERE id = 'a9d027b4-ac49-4fb1-9f6d-45af15f64e7a'; | ||
UPDATE notification_templates SET body_template = E'{{ if eq (len .Data.volumes) 1 }}{{ $volume := index .Data.volumes 0 }}'|| | ||
E'Volume **`{{$volume.path}}`** is over {{$volume.threshold}} full in workspace **{{.Labels.workspace}}**.'|| | ||
E'{{ else }}'|| | ||
E'The following volumes are nearly full in workspace **{{.Labels.workspace}}**\n\n'|| | ||
E'{{ range $volume := .Data.volumes }}'|| | ||
E'- **`{{$volume.path}}`** is over {{$volume.threshold}} full\n'|| | ||
E'{{ end }}'|| | ||
E'{{ end }}' WHERE id = 'f047f6a3-5713-40f7-85aa-0394cce9fa3a'; | ||
UPDATE notification_templates SET body_template = E'This is a test notification.' WHERE id = 'c425f63e-716a-4bf4-ae24-78348f706c3f'; | ||
UPDATE notification_templates SET body_template = E'The template **{{.Labels.name}}** was deleted by **{{ .Labels.initiator }}**.\n\n' WHERE id = '29a09665-2a4c-403f-9648-54301670e7be'; | ||
UPDATE notification_templates SET body_template = 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'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 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Hi {{ .UserName }}, | ||
|
||
{{ .Labels._body }} | ||
|
||
{{ range $action := .Actions }} | ||
|
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
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
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
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
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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix the indentation (2 spaces?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be better ✅ I also regenerated.
It still creates a few changes on the golden-files which is cool I think as they were not uniformized - not they will be.