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

* fix: update email template for update role

* fix: remove space
This commit is contained in:
Nityananda Gohain 2025-08-29 12:21:03 +05:30 committed by GitHub
parent 88dff3f552
commit 1a193fb1a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 11 deletions

View File

@ -21,6 +21,8 @@ import (
"github.com/SigNoz/signoz/pkg/types/emailtypes" "github.com/SigNoz/signoz/pkg/types/emailtypes"
"github.com/SigNoz/signoz/pkg/valuer" "github.com/SigNoz/signoz/pkg/valuer"
"github.com/google/uuid" "github.com/google/uuid"
"golang.org/x/text/cases"
"golang.org/x/text/language"
) )
type Module struct { 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 the role is updated then send an email
if existingUser.Role != updatedUser.Role { 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, "CustomerName": existingUser.DisplayName,
"UpdatedByEmail": requestor.Email, "UpdatedByEmail": requestor.Email,
"OldRole": existingUser.Role, "OldRole": cases.Title(language.English).String(strings.ToLower(existingUser.Role)),
"NewRole": updatedUser.Role, "NewRole": cases.Title(language.English).String(strings.ToLower(updatedUser.Role)),
}); err != nil { }); err != nil {
m.settings.Logger().ErrorContext(ctx, "failed to send email", "error", err) m.settings.Logger().ErrorContext(ctx, "failed to send email", "error", err)
} }

View File

@ -1,9 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<p>Hi {{.CustomerName}},</p> Hi {{.CustomerName}},<br>
Your role in <strong>SigNoz</strong> has been updated by {{.UpdatedByEmail}}.
<p>We wanted to inform you that your role in the <strong>SigNoz</strong> project has been updated by <strong>{{.UpdatedByEmail}}</strong>.</p>
<p> <p>
<strong>Previous Role:</strong> {{.OldRole}}<br> <strong>Previous Role:</strong> {{.OldRole}}<br>
@ -11,13 +10,19 @@
</p> </p>
<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>
<p> {{if eq .OldRole "Admin"}}
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:support@signoz.io">support@signoz.io</a>. <p>
</p> If you were not expecting this change or have any questions, please contact us at <a href="mailto:support@signoz.io">support@signoz.io</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> </body>
</html> </html>