Skip to content

Commit

Permalink
Add profile name to new team owner welcome mail (#4378)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanwire authored Dec 17, 2024
1 parent fc9e266 commit 5a260a0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 23 deletions.
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/WPB-15085
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add profile name to new team owner welcome mail
10 changes: 0 additions & 10 deletions libs/wire-subsystems/src/Wire/EmailSubsystem/Template.hs
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,6 @@ data MemberWelcomeEmailTemplate = MemberWelcomeEmailTemplate
memberWelcomeEmailSenderName :: !Text
}

data PersonalUserMemberWelcomeEmailTemplate = PersonalUserMemberWelcomeEmailTemplate
{ personalUserMemberWelcomeEmailUrl :: !Text,
personalUserMemberWelcomeEmailSubject :: !Template,
personalUserMemberWelcomeEmailBodyText :: !Template,
personalUserMemberWelcomeEmailBodyHtml :: !Template,
personalUserMemberWelcomeEmailSender :: !EmailAddress,
personalUserMemberWelcomeEmailSenderName :: !Text
}

data NewTeamOwnerWelcomeEmailTemplate = NewTeamOwnerWelcomeEmailTemplate
{ newTeamOwnerWelcomeEmailUrl :: !Text,
newTeamOwnerWelcomeEmailSubject :: !Template,
Expand All @@ -233,6 +224,5 @@ data TeamTemplates = TeamTemplates
existingUserInvitationEmail :: !InvitationEmailTemplate,
creatorWelcomeEmail :: !CreatorWelcomeEmailTemplate,
memberWelcomeEmail :: !MemberWelcomeEmailTemplate,
personalUserMemberWelcomeEmail :: !PersonalUserMemberWelcomeEmailTemplate,
newTeamOwnerWelcomeEmail :: !NewTeamOwnerWelcomeEmailTemplate
}
1 change: 1 addition & 0 deletions services/brig/src/Brig/API/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ upgradePersonalToTeam luid bNewTeam = do
tid
bNewTeam.bnuTeam.newTeamName.fromRange
(Just user.userLocale)
user.userDisplayName

pure $! createUserTeam

Expand Down
11 changes: 6 additions & 5 deletions services/brig/src/Brig/Team/Email.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ sendMemberWelcomeMail to tid teamName loc = do
branding <- asks (.templateBranding)
liftSem $ sendMail $ renderMemberWelcomeMail to tid teamName tpl branding

sendNewTeamOwnerWelcomeEmail :: (Member EmailSending r) => EmailAddress -> TeamId -> Text -> Maybe Locale -> (AppT r) ()
sendNewTeamOwnerWelcomeEmail to tid teamName loc = do
sendNewTeamOwnerWelcomeEmail :: (Member EmailSending r) => EmailAddress -> TeamId -> Text -> Maybe Locale -> Name -> (AppT r) ()
sendNewTeamOwnerWelcomeEmail to tid teamName loc profileName = do
tpl <- newTeamOwnerWelcomeEmail . snd <$> teamTemplatesWithLocale loc
branding <- asks (.templateBranding)
liftSem $ sendMail $ renderNewTeamOwnerWelcomeEmail to tid teamName tpl branding
liftSem $ sendMail $ renderNewTeamOwnerWelcomeEmail to tid teamName profileName tpl branding

-------------------------------------------------------------------------------
-- Member Welcome Email
Expand Down Expand Up @@ -74,8 +74,8 @@ renderMemberWelcomeMail emailTo tid teamName MemberWelcomeEmailTemplate {..} bra
-------------------------------------------------------------------------------
-- New Team Owner Welcome Email

renderNewTeamOwnerWelcomeEmail :: EmailAddress -> TeamId -> Text -> NewTeamOwnerWelcomeEmailTemplate -> TemplateBranding -> Mail
renderNewTeamOwnerWelcomeEmail emailTo tid teamName NewTeamOwnerWelcomeEmailTemplate {..} branding =
renderNewTeamOwnerWelcomeEmail :: EmailAddress -> TeamId -> Text -> Name -> NewTeamOwnerWelcomeEmailTemplate -> TemplateBranding -> Mail
renderNewTeamOwnerWelcomeEmail emailTo tid teamName profileName NewTeamOwnerWelcomeEmailTemplate {..} branding =
(emptyMail from)
{ mailTo = [to],
mailHeaders =
Expand All @@ -94,4 +94,5 @@ renderNewTeamOwnerWelcomeEmail emailTo tid teamName NewTeamOwnerWelcomeEmailTemp
replace "email" = fromEmail emailTo
replace "team_id" = idToText tid
replace "team_name" = teamName
replace "name" = profileName.fromName
replace x = x
8 changes: 0 additions & 8 deletions services/brig/src/Brig/Team/Template.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,6 @@ loadTeamTemplates o = readLocalesDir defLocale (templateDir gOptions) "team" $ \
<*> pure (emailSender gOptions)
<*> readText fp "email/sender.txt"
)
<*> ( PersonalUserMemberWelcomeEmailTemplate
""
(template "")
(template "")
(template "")
(emailSender gOptions)
<$> readText fp "email/sender.txt"
)
<*> ( NewTeamOwnerWelcomeEmailTemplate (tCreatorWelcomeUrl tOptions)
<$> readTemplate fp "email/new-team-owner-welcome-subject.txt"
<*> readTemplate fp "email/new-team-owner-welcome.txt"
Expand Down

0 comments on commit 5a260a0

Please sign in to comment.