From 789da671d64b7eea2fa5c3a65e44584cebb87bb7 Mon Sep 17 00:00:00 2001 From: Matthew Meszaros Date: Sun, 28 Jun 2026 05:27:18 +0000 Subject: [PATCH] feat: send organization member invitations through GenerateInvitationHTML so they match the rest of the transactional mail --- internal/api/handler/organization.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/internal/api/handler/organization.go b/internal/api/handler/organization.go index 0c734024..84ee2e59 100644 --- a/internal/api/handler/organization.go +++ b/internal/api/handler/organization.go @@ -9,6 +9,7 @@ import ( "github.com/warmbly/warmbly/internal/api/middleware" "github.com/warmbly/warmbly/internal/errx" "github.com/warmbly/warmbly/internal/models" + "github.com/warmbly/warmbly/internal/notify/templates" ) // CreateOrganization creates a new organization @@ -221,16 +222,11 @@ func (h *Handler) InviteMember(c *gin.Context) { // Send invitation email if h.EmailNotificationService != nil { subject := fmt.Sprintf("You've been invited to join %s on Warmbly", orgName) - body := fmt.Sprintf(` -

You've been invited!

-

%s has invited you to join %s on Warmbly.

-

Click the link below to accept the invitation:

-

Accept Invitation

-

This invitation expires in 7 days.

-

If you don't have an account yet, you'll be able to create one when you accept the invitation.

- `, inviterName, orgName, inv.Token) - - go h.EmailNotificationService.Send(c.Request.Context(), []string{req.Email}, nil, nil, subject, body) + acceptURL := fmt.Sprintf("%s/invite?token=%s", templates.AppURL, inv.Token) + // GenerateInvitationHTML reports its own render errors to Sentry. + if body, gerr := templates.GenerateInvitationHTML(inviterName, orgName, acceptURL); gerr == nil { + go h.EmailNotificationService.Send(c.Request.Context(), []string{req.Email}, nil, nil, subject, body) + } } c.JSON(http.StatusCreated, gin.H{