summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-11-05 08:59:29 -0500
committerJoramWilander <jwawilander@gmail.com>2015-11-05 08:59:29 -0500
commit23d6cfe4d8e35f5b9d3794af8d7327e1acccd5fa (patch)
tree50b55ee90478e5476193ee45af4cbaed9a2260af /api
parent40eea5b5e31c807345b7e33e0faedbf8d00eab93 (diff)
downloadchat-23d6cfe4d8e35f5b9d3794af8d7327e1acccd5fa.tar.gz
chat-23d6cfe4d8e35f5b9d3794af8d7327e1acccd5fa.tar.bz2
chat-23d6cfe4d8e35f5b9d3794af8d7327e1acccd5fa.zip
Don't send welcome emails for users signing up from an email invite, update email content
Diffstat (limited to 'api')
-rw-r--r--api/team.go4
-rw-r--r--api/templates/invite_body.html6
-rw-r--r--api/user.go9
3 files changed, 12 insertions, 7 deletions
diff --git a/api/team.go b/api/team.go
index 7d746d922..862970887 100644
--- a/api/team.go
+++ b/api/team.go
@@ -510,16 +510,14 @@ func InviteMembers(c *Context, team *model.Team, user *model.User, invites []str
}
subjectPage := NewServerTemplatePage("invite_subject")
- subjectPage.Props["SiteURL"] = c.GetSiteURL()
subjectPage.Props["SenderName"] = sender
subjectPage.Props["TeamDisplayName"] = team.DisplayName
bodyPage := NewServerTemplatePage("invite_body")
- bodyPage.Props["SiteURL"] = c.GetSiteURL()
+ bodyPage.Props["TeamURL"] = c.GetTeamURL()
bodyPage.Props["TeamDisplayName"] = team.DisplayName
bodyPage.Props["SenderName"] = sender
bodyPage.Props["SenderStatus"] = senderRole
- bodyPage.Props["Email"] = invite
props := make(map[string]string)
props["email"] = invite
props["id"] = team.Id
diff --git a/api/templates/invite_body.html b/api/templates/invite_body.html
index 930bc099d..a96384013 100644
--- a/api/templates/invite_body.html
+++ b/api/templates/invite_body.html
@@ -18,10 +18,12 @@
<tr>
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
<h2 style="font-weight: normal; margin-top: 10px;">You've been invited</h2>
- <p>{{.Props.TeamDisplayName}} started using {{.ClientCfg.SiteName}}.<br> The team {{.Props.SenderStatus}} <strong>{{.Props.SenderName}}</strong>, has invited you to join <strong>{{.Props.TeamDisplayName}}</strong>.</p>
- <p style="margin: 20px 0 15px">
+ <p>The team {{.Props.SenderStatus}} <strong>{{.Props.SenderName}}</strong>, has invited you to join <strong>{{.Props.TeamDisplayName}}</strong>.</p>
+ <p style="margin: 30px 0 15px 10px">
<a href="{{.Props.Link}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">Join Team</a>
</p>
+ <br/>
+ <p>Mattermost lets you share messages and files from your PC or phone, with instant search and archiving. After you’ve joined <strong>{{.Props.TeamDisplayName}}</strong>, you can sign-in to your new team and access these features anytime from the web address:<br/><br/><a href="{{.Props.TeamURL}}">{{.Props.TeamURL}}</a></p>
</td>
</tr>
<tr>
diff --git a/api/user.go b/api/user.go
index 42d3a43e7..c871d7c79 100644
--- a/api/user.go
+++ b/api/user.go
@@ -87,6 +87,8 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
hash := r.URL.Query().Get("h")
+ sendWelcomeEmail := true
+
if IsVerifyHashRequired(user, team, hash) {
data := r.URL.Query().Get("d")
props := model.MapFromJson(strings.NewReader(data))
@@ -109,6 +111,7 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
user.Email = props["email"]
user.EmailVerified = true
+ sendWelcomeEmail = false
}
if len(user.AuthData) > 0 && len(user.AuthService) > 0 {
@@ -120,6 +123,10 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ if sendWelcomeEmail {
+ sendWelcomeEmailAndForget(ruser.Id, ruser.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team), ruser.EmailVerified)
+ }
+
w.Write([]byte(ruser.ToJson()))
}
@@ -198,8 +205,6 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User {
l4g.Error("Encountered an issue joining default channels user_id=%s, team_id=%s, err=%v", ruser.Id, ruser.TeamId, err)
}
- sendWelcomeEmailAndForget(ruser.Id, ruser.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team), user.EmailVerified)
-
addDirectChannelsAndForget(ruser)
if user.EmailVerified {