Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 20 commits into from
Oct 9, 2024

Conversation

SasSwart
Copy link
Contributor

@SasSwart SasSwart commented Oct 3, 2024

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.

Copy link

github-actions bot commented Oct 3, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@SasSwart
Copy link
Contributor Author

SasSwart commented Oct 3, 2024

I have read the CLA Document and I hereby sign the CLA

cdrcommunity added a commit to coder/cla that referenced this pull request Oct 3, 2024
@SasSwart SasSwart changed the title feat(notifications): Improve notification format consistency feat(notifications): improve notification format consistency Oct 3, 2024
@mtojek mtojek requested review from mafredri and mtojek October 3, 2024 20:05
@SasSwart SasSwart changed the title feat(notifications): improve notification format consistency feat(migrations): improve notification format consistency Oct 4, 2024
@SasSwart SasSwart marked this pull request as draft October 4, 2024 08:34
Copy link
Member

@mtojek mtojek left a 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 👍

@mafredri
Copy link
Member

mafredri commented Oct 4, 2024

I think you need to regenerate the text samples with make update-golden-files, or overwrite default for updateGoldenFiles (false -> true) and rerun test.

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.

@SasSwart
Copy link
Contributor Author

SasSwart commented Oct 5, 2024

I think you need to regenerate the text samples with make update-golden-files, or overwrite default for updateGoldenFiles (false -> true) and rerun test.

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.

@SasSwart SasSwart changed the title feat(migrations): improve notification format consistency feat(coderd/notifications): improve notification format consistency Oct 5, 2024
@SasSwart SasSwart marked this pull request as ready for review October 5, 2024 13:02
@SasSwart SasSwart mentioned this pull request Oct 6, 2024
13 tasks
Copy link
Member

@mafredri mafredri left a 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.

Copy link
Member

@mtojek mtojek left a 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 👍

@SasSwart
Copy link
Contributor Author

SasSwart commented Oct 8, 2024

@mtojek @mafredri

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.
I'd particularly appreciate your thoughts on my changes in functions postUser, postFirstUser and oauthLogin

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.

Noticed a few problems in the rendered templates.
Please go through these closely to make sure they are as you're expecting.

The template **bobby-template** was deleted by **rob**.

The template's display name was **Bobby's Template**.
Copy link
Member

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.

Copy link
Contributor Author

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.

Comment on lines +3 to +5

The newly activated account belongs to **william tables** and was activated by **rob**.
Copy link
Member

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.

User account **bobby** has been deleted.

The deleted account belonged to **william tables** and was deleted by **rob**.
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

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.

LGTM modulo the existing nits.

User account **bobby** has been deleted.

The deleted account belonged to **william tables** and was deleted by **rob**.
Copy link
Contributor

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)
Copy link
Contributor

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.

@dannykopping dannykopping merged commit 9d02269 into main Oct 9, 2024
29 checks passed
@dannykopping dannykopping deleted the jjs/consistent-notification-format branch October 9, 2024 22:31
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2024
Copy link
Member

@mafredri mafredri left a 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.

@mtojek
Copy link
Member

mtojek commented Oct 12, 2024

Re #14967 (comment):

I wondered about this, but didn't want to assume I could overwrite what was specified.
Will update.

@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.

Screenshot 2024-10-12 at 21 18 40

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.

4 participants