Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: update email template for update role (#8610)

Nityananda Gohain1a193fb1a992
diff --git a/pkg/modules/user/impluser/module.go b/pkg/modules/user/impluser/module.go
index 2a0c80e325..3551ccf1b5 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 8815c6a2b1..12f96586fb 100644
--- a/templates/email/update_role.gotmpl
+++ b/templates/email/update_role.gotmpl
@@ -1,9 +1,8 @@
<!DOCTYPE html>
<html>
<body>
- <p>Hi {{.CustomerName}},</p>
-
- <p>We wanted to inform you that your role in the <strong>SigNoz</strong> project has been updated by <strong>{{.UpdatedByEmail}}</strong>.</p>
+ Hi {{.CustomerName}},<br>
+ Your role in <strong>SigNoz</strong> has been updated by {{.UpdatedByEmail}}.
<p>
<strong>Previous Role:</strong> {{.OldRole}}<br>
@@ -11,13 +10,19 @@
</p>
<p>
- Please note that you will need to <strong>log out and log back in</strong> 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.
</p>
- <p>
- If you were not expecting this change or have any questions, please reach out to your project administrator or contact us at <a href="mailto:[email protected]">[email protected]</a>.
- </p>
+ {{if eq .OldRole "Admin"}}
+ <p>
+ If you were not expecting this change or have any questions, please contact us at <a href="mailto:[email protected]">[email protected]</a>.
+ </p>
+ {{else}}
+ <p>
+ If you were not expecting this change or have any questions, please reach out to your administrator.
+ </p>
+ {{end}}
- <p>Thanks,<br/>The SigNoz Team</p>
+ <p>Best regards,<br>The SigNoz Team</p>
</body>
</html>
\ No newline at end of file