mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd/notifications): improve notification format consistency (#14967)
This Pull request addresses the more trivial items in https://github.com/coder/coder/issues/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.
This commit is contained in:
@@ -1128,6 +1128,7 @@ func (s *server) notifyWorkspaceManualBuildFailed(ctx context.Context, workspace
|
||||
map[string]string{
|
||||
"name": workspace.Name,
|
||||
"template_name": template.Name,
|
||||
"template_display_name": template.DisplayName,
|
||||
"template_version_name": templateVersion.Name,
|
||||
"initiator": build.InitiatorByUsername,
|
||||
"workspace_owner_username": workspaceOwner.Username,
|
||||
|
||||
@@ -1820,7 +1820,7 @@ func TestNotifications(t *testing.T) {
|
||||
_ = dbgen.OrganizationMember(t, db, database.OrganizationMember{UserID: user.ID, OrganizationID: pd.OrganizationID})
|
||||
|
||||
template := dbgen.Template(t, db, database.Template{
|
||||
Name: "template", Provisioner: database.ProvisionerTypeEcho, OrganizationID: pd.OrganizationID,
|
||||
Name: "template", DisplayName: "William's Template", Provisioner: database.ProvisionerTypeEcho, OrganizationID: pd.OrganizationID,
|
||||
})
|
||||
workspace := dbgen.Workspace(t, db, database.Workspace{
|
||||
TemplateID: template.ID, OwnerID: user.ID, OrganizationID: pd.OrganizationID,
|
||||
@@ -1860,6 +1860,7 @@ func TestNotifications(t *testing.T) {
|
||||
assert.Contains(t, notifEnq.Sent[0].Targets, user.ID)
|
||||
assert.Equal(t, workspace.Name, notifEnq.Sent[0].Labels["name"])
|
||||
assert.Equal(t, template.Name, notifEnq.Sent[0].Labels["template_name"])
|
||||
assert.Equal(t, template.DisplayName, notifEnq.Sent[0].Labels["template_display_name"])
|
||||
assert.Equal(t, version.Name, notifEnq.Sent[0].Labels["template_version_name"])
|
||||
assert.Equal(t, user.Username, notifEnq.Sent[0].Labels["initiator"])
|
||||
assert.Equal(t, user.Username, notifEnq.Sent[0].Labels["workspace_owner_username"])
|
||||
|
||||
Reference in New Issue
Block a user