From c3e9c414408a8c9c2806af12e659e395c605496f Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Mon, 28 May 2018 16:20:08 +0200 Subject: [MM-1915] Add Deactivate Account - server side (#8699) --- app/email.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'app') diff --git a/app/email.go b/app/email.go index aa05cefdb..206c48aaa 100644 --- a/app/email.go +++ b/app/email.go @@ -322,6 +322,28 @@ func (a *App) NewEmailTemplate(name, locale string) *utils.HTMLTemplate { return t } +func (a *App) SendDeactivateAccountEmail(email string, locale, siteURL string) *model.AppError { + T := utils.GetUserTranslations(locale) + + rawUrl, _ := url.Parse(siteURL) + + subject := T("api.templates.deactivate_subject", + map[string]interface{}{"SiteName": a.ClientConfig()["SiteName"], + "ServerURL": rawUrl.Host}) + + bodyPage := a.NewEmailTemplate("deactivate_body", locale) + bodyPage.Props["SiteURL"] = siteURL + bodyPage.Props["Title"] = T("api.templates.deactivate_body.title", map[string]interface{}{"ServerURL": rawUrl.Host}) + bodyPage.Html["Info"] = utils.TranslateAsHtml(T, "api.templates.deactivate_body.info", + map[string]interface{}{"SiteURL": siteURL}) + + if err := a.SendMail(email, subject, bodyPage.Render()); err != nil { + return model.NewAppError("SendDeactivateEmail", "api.user.send_deactivate_email_and_forget.failed.error", nil, err.Error(), http.StatusInternalServerError) + } + + return nil +} + func (a *App) SendMail(to, subject, htmlBody string) *model.AppError { license := a.License() return utils.SendMailUsingConfig(to, subject, htmlBody, a.Config(), license != nil && *license.Features.Compliance) -- cgit v1.2.3-1-g7c22 From c37d153ffb276e501660133de836a61eec25e544 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Mon, 28 May 2018 22:31:08 +0800 Subject: [MM-10519] Send websocket event whenever the channel has changed it's type (public|private) (#8798) * send websocket event whenever the channel has changed it's type (public|private) * updated per comment Signed-off-by: Saturnino Abril * add channel_converted websocket event Signed-off-by: Saturnino Abril * only send channel_id via websocket message for "channel_converted" event Signed-off-by: Saturnino Abril --- app/channel.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app') diff --git a/app/channel.go b/app/channel.go index 26e3d771c..b5afdea2d 100644 --- a/app/channel.go +++ b/app/channel.go @@ -366,6 +366,12 @@ func (a *App) UpdateChannelPrivacy(oldChannel *model.Channel, user *model.User) return channel, err } + a.InvalidateCacheForChannel(channel) + + messageWs := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_CONVERTED, channel.TeamId, "", "", nil) + messageWs.Add("channel_id", channel.Id) + a.Publish(messageWs) + return channel, nil } } -- cgit v1.2.3-1-g7c22