summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorAsaad Mahmood <Unknowngi@live.com>2015-07-31 15:59:11 +0500
committerAsaad Mahmood <Unknowngi@live.com>2015-07-31 15:59:11 +0500
commitad0231f27555300b070cff54d51a2bc93f20c8ba (patch)
tree1b057f2bb8cbe15e586c12f16c175ad05aa3c912 /api
parentb6018c390fc935e09ba2ba87a4ae44caaa380ba6 (diff)
parent8265e5ed8215dcf0cf4ca3438f5f2e62576656fe (diff)
downloadchat-ad0231f27555300b070cff54d51a2bc93f20c8ba.tar.gz
chat-ad0231f27555300b070cff54d51a2bc93f20c8ba.tar.bz2
chat-ad0231f27555300b070cff54d51a2bc93f20c8ba.zip
Merge branch 'master' of https://github.com/mattermost/platform
Diffstat (limited to 'api')
-rw-r--r--api/team.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/api/team.go b/api/team.go
index c9fe42ecc..01c8e50b6 100644
--- a/api/team.go
+++ b/api/team.go
@@ -275,11 +275,24 @@ func emailTeams(c *Context, w http.ResponseWriter, r *http.Request) {
subjectPage := NewServerTemplatePage("find_teams_subject", c.GetSiteURL())
bodyPage := NewServerTemplatePage("find_teams_body", c.GetSiteURL())
- if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
- l4g.Error("An error occured while sending an email in emailTeams err=%v", err)
- }
+ if result := <-Srv.Store.Team().GetTeamsForEmail(email); result.Err != nil {
+ c.Err = result.Err
+ } else {
+ teams := result.Data.([]*model.Team)
- w.Write([]byte(model.MapToJson(m)))
+ // the template expects Props to be a map with team names as the keys
+ props := make(map[string]string)
+ for _, team := range teams {
+ props[team.Name] = team.Name
+ }
+ bodyPage.Props = props
+
+ if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
+ l4g.Error("An error occured while sending an email in emailTeams err=%v", err)
+ }
+
+ w.Write([]byte(model.MapToJson(m)))
+ }
}
func inviteMembers(c *Context, w http.ResponseWriter, r *http.Request) {