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
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
70f3486
feat(notifications): Improve notification format consistency
SasSwart Oct 3, 2024
7e31a34
chore(coderd/notifications): regenerate notification testdata from th…
SasSwart Oct 5, 2024
cf3afd4
Merge remote-tracking branch 'origin/main' into jjs/consistent-notifi…
SasSwart Oct 5, 2024
4b85f2b
chore(coderd/database): renumber migration
SasSwart Oct 5, 2024
e8ad3ac
chore(coderd/notifications): regenerate testdata
SasSwart Oct 5, 2024
2a4d740
fix(coderd/notifications): remove duplicate function signature
SasSwart Oct 5, 2024
e741c43
chore: remove redundant escaping in migration
SasSwart Oct 5, 2024
adffe60
chore(coderd/notifications): improve failed test feedback
SasSwart Oct 5, 2024
41ed54a
feat(coderd/database): add new information to the account activated n…
SasSwart Oct 7, 2024
5541331
Merge remote-tracking branch 'origin/main' into jjs/additional-notifi…
SasSwart Oct 8, 2024
fe94f0d
chore(coderd/database): rework migration for legibility
SasSwart Oct 8, 2024
98e7501
feat(coderd): send newly required information to notification templates
SasSwart Oct 8, 2024
d8e00c2
feat(coderd/notifications): provide additional context to workspace n…
SasSwart Oct 8, 2024
d6a339f
fix(coderd/notifications): add a missing call to fmt.Sprintf
SasSwart Oct 8, 2024
920ad31
fix(coderd/notifications): fix oversights in template migration
SasSwart Oct 9, 2024
9e938e5
chore(coderd/provisionerdserver): set the displayname in TestNotifica…
SasSwart Oct 9, 2024
59e57ac
chore(coderd): add more robust testing assertions to TestNotifyDelete…
SasSwart Oct 9, 2024
c907238
chore(coderd/notifications): fix migration indentation
SasSwart Oct 9, 2024
2493556
chore(coderd/notifications): regenerate golden files
SasSwart Oct 9, 2024
19dccc8
Merge remote-tracking branch 'origin/main' into jjs/consistent-notifi…
SasSwart Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(coderd): add more robust testing assertions to TestNotifyDelete…
…dUser
  • Loading branch information
SasSwart committed Oct 9, 2024
commit 59e57ac26c4fd537dd9dbbee250d01ee5ff4e521
12 changes: 7 additions & 5 deletions coderd/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,16 @@ func TestNotifyDeletedUser(t *testing.T) {
adminClient := coderdtest.New(t, &coderdtest.Options{
NotificationsEnqueuer: notifyEnq,
})
firstUser := coderdtest.CreateFirstUser(t, adminClient)
firstUserResponse := coderdtest.CreateFirstUser(t, adminClient)

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()

firstUser, err := adminClient.User(ctx, firstUserResponse.UserID.String())
require.NoError(t, err)

user, err := adminClient.CreateUserWithOrgs(ctx, codersdk.CreateUserRequestWithOrgs{
OrganizationIDs: []uuid.UUID{firstUser.OrganizationID},
OrganizationIDs: []uuid.UUID{firstUserResponse.OrganizationID},
Email: "[email protected]",
Username: "someone-else",
Password: "SomeSecurePassword!",
Expand All @@ -510,12 +513,11 @@ func TestNotifyDeletedUser(t *testing.T) {
require.Len(t, notifyEnq.Sent, 2)
// notifyEnq.Sent[0] is create account event
require.Equal(t, notifications.TemplateUserAccountDeleted, notifyEnq.Sent[1].TemplateID)
require.Equal(t, firstUser.UserID, notifyEnq.Sent[1].UserID)
require.Equal(t, firstUser.ID, notifyEnq.Sent[1].UserID)
require.Contains(t, notifyEnq.Sent[1].Targets, user.ID)
require.Equal(t, user.Username, notifyEnq.Sent[1].Labels["deleted_account_name"])
require.Equal(t, user.Name, notifyEnq.Sent[1].Labels["deleted_account_user_name"])
// Not sure where to get the following just yet
// require.Equal(t, , notifyEnq.Sent[1].Labels["account_deleter_user_name"])
require.Equal(t, firstUser.Name, notifyEnq.Sent[1].Labels["account_deleter_user_name"])
})

t.Run("UserAdminNotified", func(t *testing.T) {
Expand Down
Loading