satellite/{consoleweb,emails}: send new email for project invite

This change adds new email templates for project invites, one for
existing users, one for new users. It changes the project invite code
to use the new template for existing users.

Issue: https://github.com/storj/storj/issues/5860

Change-Id: Ic7b14a677277ea6c25ee527d03f709474fc05f83
This commit is contained in:
Wilfred Asomani 2023-05-19 13:23:04 +00:00 committed by Storj Robot
parent 5ee991ac64
commit 58836834da
7 changed files with 430 additions and 11 deletions

View File

@ -18,4 +18,6 @@ const (
ContactInfoURL = "contactInfoURL"
// TermsAndConditionsURL is a key to store terms and conditions URL.
TermsAndConditionsURL = "termsAndConditionsURL"
// SatelliteRegion is a key to store the satellite's region/name.
SatelliteRegion = "satelliteRegion"
)

View File

@ -191,21 +191,15 @@ func rootMutation(log *zap.Logger, service *console.Service, mailService *mailse
userName = user.FullName
}
contactInfoURL := rootObject[ContactInfoURL].(string)
letUsKnowURL := rootObject[LetUsKnowURL].(string)
termsAndConditionsURL := rootObject[TermsAndConditionsURL].(string)
satelliteRegion := rootObject[SatelliteRegion].(string)
mailService.SendRenderedAsync(
p.Context,
[]post.Address{{Address: user.Email, Name: userName}},
&console.ProjectInvitationEmail{
Origin: origin,
UserName: userName,
InviterEmail: inviter.Email,
SignInLink: signIn,
LetUsKnowURL: letUsKnowURL,
TermsAndConditionsURL: termsAndConditionsURL,
ContactInfoURL: contactInfoURL,
&console.ExistingUserProjectInvitationEmail{
InviterEmail: inviter.Email,
Region: satelliteRegion,
SignInLink: signIn,
},
)
}

View File

@ -138,6 +138,7 @@ func TestGraphqlMutation(t *testing.T) {
rootObject[consoleql.LetUsKnowURL] = "letUsKnowURL"
rootObject[consoleql.ContactInfoURL] = "contactInfoURL"
rootObject[consoleql.TermsAndConditionsURL] = "termsAndConditionsURL"
rootObject[consoleql.SatelliteRegion] = "EU1"
schema, err := consoleql.CreateSchema(log, service, mailService)
require.NoError(t, err)

View File

@ -712,6 +712,7 @@ func (server *Server) graphqlHandler(w http.ResponseWriter, r *http.Request) {
rootObject[consoleql.LetUsKnowURL] = server.config.LetUsKnowURL
rootObject[consoleql.ContactInfoURL] = server.config.ContactInfoURL
rootObject[consoleql.TermsAndConditionsURL] = server.config.TermsAndConditionsURL
rootObject[consoleql.SatelliteRegion] = server.config.SatelliteName
result := graphql.Do(graphql.Params{
Schema: server.schema,

View File

@ -55,6 +55,36 @@ func (email *ProjectInvitationEmail) Subject() string {
return "You were invited to join a project on Storj"
}
// ExistingUserProjectInvitationEmail is mailservice template for project invitation email for existing users.
type ExistingUserProjectInvitationEmail struct {
InviterEmail string
Region string
SignInLink string
}
// Template returns email template name.
func (*ExistingUserProjectInvitationEmail) Template() string { return "ExistingUserInvite" }
// Subject gets email subject.
func (email *ExistingUserProjectInvitationEmail) Subject() string {
return "You were invited to join a project on Storj"
}
// NewUserProjectInvitationEmail is mailservice template for project invitation email for new users.
type NewUserProjectInvitationEmail struct {
InviterEmail string
Region string
SignUpLink string
}
// Template returns email template name.
func (*NewUserProjectInvitationEmail) Template() string { return "NewUserInvite" }
// Subject gets email subject.
func (email *NewUserProjectInvitationEmail) Subject() string {
return "You were invited to join a project on Storj"
}
// UnknownResetPasswordEmail is mailservice template with unknown password reset data.
type UnknownResetPasswordEmail struct {
Satellite string

View File

@ -0,0 +1,196 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office"
style="width:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;padding:0;Margin:0">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta name="x-apple-disable-message-reformatting">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="telephone=no" name="format-detection">
<title>Project Invitation</title><!--[if (mso 16)]>
<style type="text/css">
a {
text-decoration: none;
}
</style>
<![endif]--><!--[if gte mso 9]>
<style>sup {
font-size: 100% !important;
}</style><![endif]--><!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG></o:AllowPNG>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<style type="text/css">
#outlook a {
padding: 0;
}
.es-button {
mso-style-priority: 100 !important;
text-decoration: none !important;
}
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
@media only screen and (max-width: 600px) {
p, ul li, ol li, a {
line-height: 150% !important
}
h1, h2, h3, h1 a, h2 a, h3 a {
line-height: 120% !important
}
h1 {
font-size: 30px !important;
text-align: center
}
h2 {
font-size: 26px !important;
text-align: center
}
h3 {
font-size: 20px !important;
text-align: center
}
.es-content-body h1 a {
font-size: 30px !important
}
.es-content-body h2 a {
font-size: 26px !important
}
.es-content-body h3 a {
font-size: 20px !important
}
.es-content-body p, .es-content-body ul li, .es-content-body ol li, .es-content-body a {
font-size: 16px !important
}
.es-button-border {
display: block !important
}
a.es-button, button.es-button {
font-size: 20px !important;
display: block !important;
padding: 15px 25px 15px 25px !important
}
.es-content table, .es-content {
width: 100% !important;
max-width: 600px !important
}
.adapt-img {
width: 100% !important;
height: auto !important
}
}
</style>
</head>
<body style="width:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;font-family:'helvetica neue', helvetica, arial, sans-serif;padding:0;Margin:0">
<div class="es-wrapper-color" style="background-color:#F6F6F6"><!--[if gte mso 9]>
<v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
<v:fill type="tile" color="#f6f6f6"></v:fill>
</v:background>
<![endif]-->
<table class="es-wrapper" width="100%" cellspacing="0" cellpadding="0"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;padding:0;Margin:0;width:100%;height:100%;background-repeat:repeat;background-position:center top;background-color:#F6F6F6">
<tr style="border-collapse:collapse">
<td valign="top" style="padding:0;Margin:0">
<table class="es-content" cellspacing="0" cellpadding="0" align="center"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%">
<tr style="border-collapse:collapse">
<td style="padding:0;Margin:0;background-color:#fafafb;background-size:cover" bgcolor="#FAFAFB"
align="center">
<table class="es-content-body"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:transparent;width:640px"
cellspacing="0" cellpadding="0" bgcolor="#f6f6f6" align="center">
<tr style="border-collapse:collapse">
<td align="left"
style="padding:0;Margin:0;padding-top:20px;padding-left:20px;padding-right:20px">
<table width="100%" cellspacing="0" cellpadding="0"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr style="border-collapse:collapse">
<td valign="top" align="center" style="padding:0;Margin:0;width:600px">
<table width="100%" cellspacing="0" cellpadding="0"
role="presentation"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr style="border-collapse:collapse">
<td align="center"
style="padding:0;Margin:0;padding-top:25px;padding-bottom:30px">
<h1 style="Margin:0;line-height:67px;mso-line-height-rule:exactly;font-family:'helvetica neue', helvetica, arial, sans-serif;font-size:56px;font-style:normal;font-weight:bold;color:#091c45">
You were invited<br>to a project on Storj</h1></td>
</tr>
<tr style="border-collapse:collapse">
<td esdev-links-color="#b7bdc9" align="center"
style="padding:0;Margin:0"><p
style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:'helvetica neue', helvetica, arial, sans-serif;line-height:21px;color:#091c45;font-size:14px">
{{ .InviterEmail }} has invited you to
a project on Storj DCS on the {{ .Region }}
region.</p></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center"
style="margin:0;padding: 25px 0 50px;">
<!--[if mso]>
<a href="{{ .SignInLink }}" target="_blank"
hidden>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="urn:schemas-microsoft-com:office:word"
esdevVmlButton
href="{{ .SignInLink }}"
style="height:46px; v-text-anchor:middle; width:195px"
arcsize="22%" stroke="f"
fillcolor="#00ac26">
<w:anchorlock></w:anchorlock>
<center style='color:#ffffff; font-family:"helvetica neue", helvetica, arial, sans-serif; font-size:14px; font-weight:400; line-height:14px; mso-text-raise:1px'>
Accept Invitation →
</center>
</v:roundrect>
</a>
<![endif]-->
<!--[if !mso]><!-->
<span class="msohide es-button-border"
style="box-shadow: 0px 20px 30px rgba(10, 27, 44, 0.2);border-style:solid;border-color:#75B6C9;background:#00ac26;border-width:0px;display:inline-block;border-radius:10px;width:auto;mso-hide:all">
<a href="{{ .SignInLink }}"
class="es-button msohide" target="_blank"
style="mso-style-priority:100 !important;text-decoration:none;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;color:#ffffff;font-size:14px;display:inline-block;background:#00ac26;border-radius:10px;font-family:'helvetica neue', helvetica, arial, sans-serif;font-weight:700;font-style:normal;line-height:17px;width:auto;text-align:center;padding:15px 25px 15px 25px;mso-padding-alt:0;mso-border-alt:10px solid #75B6C9;mso-hide:all">Accept Invitation →</a>
</span>
<!--<![endif]-->
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -0,0 +1,195 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office"
style="width:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;padding:0;Margin:0">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta name="x-apple-disable-message-reformatting">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="telephone=no" name="format-detection">
<title>Project Invitation</title><!--[if (mso 16)]>
<style type="text/css">
a {
text-decoration: none;
}
</style>
<![endif]--><!--[if gte mso 9]>
<style>sup {
font-size: 100% !important;
}</style><![endif]--><!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG></o:AllowPNG>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<style type="text/css">
#outlook a {
padding: 0;
}
.es-button {
mso-style-priority: 100 !important;
text-decoration: none !important;
}
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
@media only screen and (max-width: 600px) {
p, ul li, ol li, a {
line-height: 150% !important
}
h1, h2, h3, h1 a, h2 a, h3 a {
line-height: 120% !important
}
h1 {
font-size: 30px !important;
text-align: center
}
h2 {
font-size: 26px !important;
text-align: center
}
h3 {
font-size: 20px !important;
text-align: center
}
.es-content-body h1 a {
font-size: 30px !important
}
.es-content-body h2 a {
font-size: 26px !important
}
.es-content-body h3 a {
font-size: 20px !important
}
.es-content-body p, .es-content-body ul li, .es-content-body ol li, .es-content-body a {
font-size: 16px !important
}
.es-button-border {
display: block !important
}
a.es-button, button.es-button {
font-size: 20px !important;
display: block !important;
padding: 15px 25px 15px 25px !important
}
.es-content table, .es-content {
width: 100% !important;
max-width: 600px !important
}
.adapt-img {
width: 100% !important;
height: auto !important
}
}
</style>
</head>
<body style="width:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;font-family:'helvetica neue', helvetica, arial, sans-serif;padding:0;Margin:0">
<div class="es-wrapper-color" style="background-color:#F6F6F6"><!--[if gte mso 9]>
<v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
<v:fill type="tile" color="#f6f6f6"></v:fill>
</v:background>
<![endif]-->
<table class="es-wrapper" width="100%" cellspacing="0" cellpadding="0"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;padding:0;Margin:0;width:100%;height:100%;background-repeat:repeat;background-position:center top;background-color:#F6F6F6">
<tr style="border-collapse:collapse">
<td valign="top" style="padding:0;Margin:0">
<table class="es-content" cellspacing="0" cellpadding="0" align="center"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%">
<tr style="border-collapse:collapse">
<td style="padding:0;Margin:0;background-color:#fafafb;background-size:cover" bgcolor="#FAFAFB"
align="center">
<table class="es-content-body"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:transparent;width:800px"
cellspacing="0" cellpadding="0" bgcolor="#f6f6f6" align="center">
<tr style="border-collapse:collapse">
<td align="left"
style="padding:0;Margin:0;padding-top:20px;padding-left:20px;padding-right:20px">
<table width="100%" cellspacing="0" cellpadding="0"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr style="border-collapse:collapse">
<td valign="top" align="center" style="padding:0;Margin:0;width:760px">
<table width="100%" cellspacing="0" cellpadding="0"
role="presentation"
style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
<tr style="border-collapse:collapse">
<td align="center"
style="padding:0;Margin:0;padding-top:20px;padding-bottom:20px">
<h1 style="Margin:0;line-height:67px;mso-line-height-rule:exactly;font-family:'helvetica neue', helvetica, arial, sans-serif;font-size:56px;font-style:normal;font-weight:bold;color:#091c45">
You were invited<br>to a project on Storj</h1></td>
</tr>
<tr style="border-collapse:collapse">
<td esdev-links-color="#b7bdc9" align="center"
style="padding:0;Margin:0"><p
style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:'helvetica neue', helvetica, arial, sans-serif;line-height:21px;color:#091c45;font-size:14px">
{{ .InviterEmail }} has invited you to a project on <a target="_blank"
style="-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;text-decoration:underline;color:#091c45;font-size:14px;font-family:'helvetica neue', helvetica, arial, sans-serif"
href="https://www.storj.io">Storj</a>.<br>Create
an account on the {{ .Region }} region, to join {{ .InviterEmail }} in
the project.</p></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center"
style="margin:0;padding: 25px 0 50px;">
<!--[if mso]><a href="{{ .SignUpLink }}"
target="_blank" hidden>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="urn:schemas-microsoft-com:office:word"
esdevVmlButton href="{{ .SignUpLink }}"
style="height:46px; v-text-anchor:middle; width:205px"
arcsize="22%" stroke="f" fillcolor="#00ac26">
<w:anchorlock></w:anchorlock>
<center style='color:#ffffff; font-family:"helvetica neue", helvetica, arial, sans-serif; font-size:14px; font-weight:400; line-height:14px; mso-text-raise:1px'>
Create an account →
</center>
</v:roundrect>
</a>
<![endif]-->
<!--[if !mso]><!-->
<span class="msohide es-button-border"
style="box-shadow: 0px 20px 30px rgba(10, 27, 44, 0.2);border-style:solid;border-color:#75B6C9;background:#00ac26;border-width:0px;display:inline-block;border-radius:10px;width:auto;mso-hide:all">
<a href="{{ .SignUpLink }}"
class="es-button msohide" target="_blank"
style="mso-style-priority:100 !important;text-decoration:none;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;color:#ffffff;font-size:14px;display:inline-block;background:#00ac26;border-radius:10px;font-family:'helvetica neue', helvetica, arial, sans-serif;font-weight:700;font-style:normal;line-height:17px;width:auto;text-align:center;padding:15px 25px 15px 25px;mso-padding-alt:0;mso-border-alt:10px solid #75B6C9;mso-hide:all">Create an account →</a>
</span>
<!--<![endif]-->
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>