Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profile name to new team owner welcome mail #4378

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading