-
Notifications
You must be signed in to change notification settings - Fork 886
feat(coderd/notifications): improve notification format consistency #14967
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
Conversation
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
coderd/database/migrations/000261_improve_notification_templates.up.sql
Outdated
Show resolved
Hide resolved
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.
I think you need to regenerate the text samples with make update-golden-files
, or overwrite default for updateGoldenFiles
(false -> true) and rerun test.
Once we have new samples, it will be straightforward to review changes 👍
We should make the test output this hint on error (i.e. change requires to assert and if test failed, show hint). Right now it's only shown when there are missing files. |
I was trying to do this for most of Friday. Turns out that the makefile wasn't actually calling the right test to update these. Firstly because it didn't have a job in the makefile for the notifications package, but also because the test wasn't named correctly. I've pushed a commit that fixes it. We now have updated testdata, which has shown some issues. I'm working on resolving them. Expect updated queries and rendered testdata soon. |
…otification body template
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.
Except for missing fmt, these look good to me. Would like to see what @mtojek thinks before merging though.
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.
Definitely better than it is now! Thanks 👍
Apologies, but I wasn't happy with the standard of the PR. I reworked it after considering some verbal feedback (thanks @mafredri and @defelmnq). I also figured out how to deal with the rest of #14893. Please have another look? Enough has changed that I would have revoked the initial approvals if I could. |
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.
Noticed a few problems in the rendered templates.
Please go through these closely to make sure they are as you're expecting.
coderd/database/migrations/000262_improve_notification_templates.up.sql
Outdated
Show resolved
Hide resolved
coderd/notifications/testdata/rendered-templates/TemplateUserAccountCreated-body.md.golden
Outdated
Show resolved
Hide resolved
.../notifications/testdata/rendered-templates/TemplateWorkspaceManualBuildFailed-body.md.golden
Outdated
Show resolved
Hide resolved
coderd/notifications/testdata/rendered-templates/TemplateWorkspaceDormant-body.md.golden
Outdated
Show resolved
Hide resolved
coderd/database/migrations/000262_improve_notification_templates.down.sql
Outdated
Show resolved
Hide resolved
coderd/database/migrations/000262_improve_notification_templates.down.sql
Outdated
Show resolved
Hide resolved
The template **bobby-template** was deleted by **rob**. | ||
|
||
The template's display name was **Bobby's Template**. |
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.
The display name is just a human-readable representation of the template name, so in this case, you don't need to indicate that it is not the real template name.
Just go with:
The template Bobby's Template was deleted by rob.
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.
I wondered about this, but didn't want to assume I could overwrite what was specified.
Will update.
|
||
The newly activated account belongs to **william tables** and was activated by **rob**. |
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.
Have we considered a bit different phrase?
The account for bobby has been activated by Rob. This account belongs to William Tables.
coderd/notifications/testdata/rendered-templates/TemplateYourAccountSuspended-body.md.golden
Outdated
Show resolved
Hide resolved
User account **bobby** has been deleted. | ||
|
||
The deleted account belonged to **william tables** and was deleted by **rob**. |
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.
Curious, if we can make notifications TemplateUserAccountDeleted
, TemplateUserAccountCreated
, TemplateUserAccountActivated
and TemplateUserAccountSuspended
sound more natural?
Any ideas, @dannykopping? Should we involve Christin?
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.
I'd be keen for a professional Wordsmith to have a look if we want.
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.
Agree, we should involve @EdwardAngert.
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.
I think we can do this in a follow-up. Let's get this merged.
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.
LGTM modulo the existing nits.
User account **bobby** has been deleted. | ||
|
||
The deleted account belonged to **william tables** and was deleted by **rob**. |
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.
Agree, we should involve @EdwardAngert.
@@ -576,11 +589,24 @@ func (api *API) deleteUser(rw http.ResponseWriter, r *http.Request) { | |||
return | |||
} | |||
|
|||
apiKey := httpmw.APIKey(r) | |||
|
|||
accountDeleter, err := api.Database.GetUserByID(ctx, apiKey.UserID) |
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.
As a follow-up PR, this feels like something that we should inject into the context.
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.
Few minor things but otherwise LGTM.
Re #14967 (comment):
@SasSwart @dannykopping Right now the result looks strange. Please take a look below at the notification I received today, it needs more love. I still don't think we need to refer to the display name specifically. ![]() |
This Pull request addresses the more trivial items in #14893.
These were simple formatting changes that I was able to fix despite limited context.
Some more changes are required for which I will have to dig a bit deeper into how the template contexts are populated. I'm happy to add those to this PR or create a subsequent PR.