From 1a193fb1a99218019947b515f2b5dd70e1ef65c9 Mon Sep 17 00:00:00 2001 From: Nityananda Gohain Date: Fri, 29 Aug 2025 12:21:03 +0530 Subject: [PATCH] fix: update email template for update role (#8610) * fix: update email template for update role * fix: remove space --- pkg/modules/user/impluser/module.go | 8 +++++--- templates/email/update_role.gotmpl | 21 +++++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/pkg/modules/user/impluser/module.go b/pkg/modules/user/impluser/module.go index 2a0c80e32556..3551ccf1b58d 100644 --- a/pkg/modules/user/impluser/module.go +++ b/pkg/modules/user/impluser/module.go @@ -21,6 +21,8 @@ import ( "github.com/SigNoz/signoz/pkg/types/emailtypes" "github.com/SigNoz/signoz/pkg/valuer" "github.com/google/uuid" + "golang.org/x/text/cases" + "golang.org/x/text/language" ) type Module struct { @@ -228,11 +230,11 @@ func (m *Module) UpdateUser(ctx context.Context, orgID string, id string, user * // if the role is updated then send an email if existingUser.Role != updatedUser.Role { - if err := m.emailing.SendHTML(ctx, existingUser.Email, "Your Role is updated in SigNoz", emailtypes.TemplateNameUpdateRole, map[string]any{ + if err := m.emailing.SendHTML(ctx, existingUser.Email, "Your Role Has Been Updated in SigNoz", emailtypes.TemplateNameUpdateRole, map[string]any{ "CustomerName": existingUser.DisplayName, "UpdatedByEmail": requestor.Email, - "OldRole": existingUser.Role, - "NewRole": updatedUser.Role, + "OldRole": cases.Title(language.English).String(strings.ToLower(existingUser.Role)), + "NewRole": cases.Title(language.English).String(strings.ToLower(updatedUser.Role)), }); err != nil { m.settings.Logger().ErrorContext(ctx, "failed to send email", "error", err) } diff --git a/templates/email/update_role.gotmpl b/templates/email/update_role.gotmpl index 8815c6a2b181..12f96586fb81 100644 --- a/templates/email/update_role.gotmpl +++ b/templates/email/update_role.gotmpl @@ -1,9 +1,8 @@ -

Hi {{.CustomerName}},

- -

We wanted to inform you that your role in the SigNoz project has been updated by {{.UpdatedByEmail}}.

+ Hi {{.CustomerName}},
+ Your role in SigNoz has been updated by {{.UpdatedByEmail}}.

Previous Role: {{.OldRole}}
@@ -11,13 +10,19 @@

- Please note that you will need to log out and log back in for the changes to take effect. + Please note that you will need to log out and log back in for the changes to take effect.

-

- If you were not expecting this change or have any questions, please reach out to your project administrator or contact us at support@signoz.io. -

+ {{if eq .OldRole "Admin"}} +

+ If you were not expecting this change or have any questions, please contact us at support@signoz.io. +

+ {{else}} +

+ If you were not expecting this change or have any questions, please reach out to your administrator. +

+ {{end}} -

Thanks,
The SigNoz Team

+

Best regards,
The SigNoz Team

\ No newline at end of file