mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Inital support for multi-tab loging
This commit is contained in:
@@ -24,7 +24,7 @@ func InitAdmin(r *mux.Router) {
|
||||
sr.Handle("/config", ApiUserRequired(getConfig)).Methods("GET")
|
||||
sr.Handle("/save_config", ApiUserRequired(saveConfig)).Methods("POST")
|
||||
sr.Handle("/test_email", ApiUserRequired(testEmail)).Methods("POST")
|
||||
sr.Handle("/client_props", ApiAppHandler(getClientProperties)).Methods("GET")
|
||||
sr.Handle("/client_props", ApiAppHandler(getClientConfig)).Methods("GET")
|
||||
sr.Handle("/log_client", ApiAppHandler(logClient)).Methods("POST")
|
||||
|
||||
}
|
||||
@@ -57,8 +57,8 @@ func getLogs(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(model.ArrayToJson(lines)))
|
||||
}
|
||||
|
||||
func getClientProperties(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(model.MapToJson(utils.ClientProperties)))
|
||||
func getClientConfig(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(model.MapToJson(utils.ClientCfg)))
|
||||
}
|
||||
|
||||
func logClient(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -20,7 +20,7 @@ func NewServerTemplatePage(templateName string) *ServerTemplatePage {
|
||||
return &ServerTemplatePage{
|
||||
TemplateName: templateName,
|
||||
Props: make(map[string]string),
|
||||
ClientProps: utils.ClientProperties,
|
||||
ClientCfg: utils.ClientCfg,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,10 @@ type Context struct {
|
||||
type Page struct {
|
||||
TemplateName string
|
||||
Props map[string]string
|
||||
ClientProps map[string]string
|
||||
ClientCfg map[string]string
|
||||
User *model.User
|
||||
Team *model.Team
|
||||
Session *model.Session
|
||||
}
|
||||
|
||||
func ApiAppHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler {
|
||||
@@ -479,7 +482,7 @@ func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
w.WriteHeader(err.StatusCode)
|
||||
ServerTemplates.ExecuteTemplate(w, "error.html", Page{Props: props, ClientProps: utils.ClientProperties})
|
||||
ServerTemplates.ExecuteTemplate(w, "error.html", Page{Props: props, ClientCfg: utils.ClientCfg})
|
||||
}
|
||||
|
||||
func Handle404(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -432,9 +432,9 @@ func emailTeams(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
subjectPage := NewServerTemplatePage("find_teams_subject")
|
||||
subjectPage.ClientProps["SiteURL"] = c.GetSiteURL()
|
||||
subjectPage.ClientCfg["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage := NewServerTemplatePage("find_teams_body")
|
||||
bodyPage.ClientProps["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage.ClientCfg["SiteURL"] = c.GetSiteURL()
|
||||
|
||||
if result := <-Srv.Store.Team().GetTeamsForEmail(email); result.Err != nil {
|
||||
c.Err = result.Err
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -38,7 +38,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "email_change_subject"}}[{{.ClientProps.SiteName}}] Your email address has changed for {{.Props.TeamDisplayName}}{{end}}
|
||||
{{define "email_change_subject"}}[{{.ClientCfg.SiteName}}] Your email address has changed for {{.Props.TeamDisplayName}}{{end}}
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -41,7 +41,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "email_change_verify_subject"}}[{{.ClientProps.SiteName}}] Verify new email address for {{.Props.TeamDisplayName}}{{end}}
|
||||
{{define "email_change_verify_subject"}}[{{.ClientCfg.SiteName}}] Verify new email address for {{.Props.TeamDisplayName}}{{end}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>{{ .ClientProps.SiteName }} - Error</title>
|
||||
<title>{{ .ClientCfg.SiteName }} - Error</title>
|
||||
|
||||
<link rel="stylesheet" href="/static/css/bootstrap-3.3.5.min.css">
|
||||
<link rel="stylesheet" href="/static/css/jasny-bootstrap.min.css" rel="stylesheet">
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="error__container">
|
||||
<div class="error__icon"><i class="fa fa-exclamation-triangle"></i></div>
|
||||
<h2>{{ .ClientProps.SiteName }} needs your help:</h2>
|
||||
<h2>{{ .ClientCfg.SiteName }} needs your help:</h2>
|
||||
<p>{{ .Props.Message }}</p>
|
||||
<a href="{{.Props.SiteURL}}">Go back to team site</a>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
|
||||
<tr>
|
||||
<td style="padding: 20px 20px 10px; text-align:left;">
|
||||
<img src="{{.ClientProps.SiteURL}}/static/images/logo-email.png" width="130px" style="opacity: 0.5" alt="">
|
||||
<img src="{{.ClientCfg.SiteURL}}/static/images/logo-email.png" width="130px" style="opacity: 0.5" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -31,9 +31,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -42,11 +42,11 @@
|
||||
<tr>
|
||||
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
|
||||
<p style="margin: 25px 0;">
|
||||
<img width="65" src="{{.ClientProps.SiteURL}}/static/images/circles.png" alt="">
|
||||
<img width="65" src="{{.ClientCfg.SiteURL}}/static/images/circles.png" alt="">
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "find_teams_subject"}}Your {{ .ClientProps.SiteName }} Teams{{end}}
|
||||
{{define "find_teams_subject"}}Your {{ .ClientCfg.SiteName }} Teams{{end}}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<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 {{.ClientProps.SiteName}}.<br> The team {{.Props.SenderStatus}} <strong>{{.Props.SenderName}}</strong>, has invited you to join <strong>{{.Props.TeamDisplayName}}</strong>.</p>
|
||||
<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">
|
||||
<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>
|
||||
@@ -26,9 +26,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -41,7 +41,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.ClientProps.SiteName}}{{end}}
|
||||
{{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.ClientCfg.SiteName}}{{end}}
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -38,7 +38,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "password_change_subject"}}You updated your password for {{.Props.TeamDisplayName}} on {{ .ClientProps.SiteName }}{{end}}
|
||||
{{define "password_change_subject"}}You updated your password for {{.Props.TeamDisplayName}} on {{ .ClientCfg.SiteName }}{{end}}
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -41,7 +41,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "post_subject"}}[{{.ClientProps.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}}
|
||||
{{define "post_subject"}}[{{.ClientCfg.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}}
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -41,7 +41,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
<p style="margin: 20px 0 25px">
|
||||
<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;">Set up your team</a>
|
||||
</p>
|
||||
{{ .ClientProps.SiteName }} is one place for all your team communication, searchable and available anywhere.<br>You'll get more out of {{ .ClientProps.SiteName }} when your team is in constant communication--let's get them on board.<br></p>
|
||||
{{ .ClientCfg.SiteName }} is one place for all your team communication, searchable and available anywhere.<br>You'll get more out of {{ .ClientCfg.SiteName }} when your team is in constant communication--let's get them on board.<br></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -41,7 +41,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "signup_team_subject"}}Invitation to {{ .ClientProps.SiteName }}{{end}}
|
||||
{{define "signup_team_subject"}}Invitation to {{ .ClientCfg.SiteName }}{{end}}
|
||||
@@ -26,9 +26,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientProps.SiteName}} Team<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -41,7 +41,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .ClientProps.SiteName }}] Email Verification{{end}}
|
||||
{{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .ClientCfg.SiteName }}] Email Verification{{end}}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientProps.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
If you no longer wish to receive these emails, click on the following link: <a href="mailto:{{.ClientCfg.FeedbackEmail}}?subject=Unsubscribe&body=Unsubscribe" style="text-decoration: none; color:#2389D7;">Unsubscribe</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -26,7 +26,7 @@ const (
|
||||
var Cfg *model.Config = &model.Config{}
|
||||
var CfgLastModified int64 = 0
|
||||
var CfgFileName string = ""
|
||||
var ClientProperties map[string]string = map[string]string{}
|
||||
var ClientCfg map[string]string = map[string]string{}
|
||||
var SanitizeOptions map[string]bool = map[string]bool{}
|
||||
|
||||
func FindConfigFile(fileName string) string {
|
||||
@@ -161,7 +161,7 @@ func LoadConfig(fileName string) {
|
||||
|
||||
Cfg = &config
|
||||
SanitizeOptions = getSanitizeOptions(Cfg)
|
||||
ClientProperties = getClientProperties(Cfg)
|
||||
ClientCfg = getClientConfig(Cfg)
|
||||
}
|
||||
|
||||
func getSanitizeOptions(c *model.Config) map[string]bool {
|
||||
@@ -172,7 +172,7 @@ func getSanitizeOptions(c *model.Config) map[string]bool {
|
||||
return options
|
||||
}
|
||||
|
||||
func getClientProperties(c *model.Config) map[string]string {
|
||||
func getClientConfig(c *model.Config) map[string]string {
|
||||
props := make(map[string]string)
|
||||
|
||||
props["Version"] = model.CurrentVersion
|
||||
|
||||
@@ -14,7 +14,7 @@ export default class AboutBuildModal extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const config = global.window.config;
|
||||
const config = global.window.mm_config;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
@@ -26,7 +26,6 @@ export default class ChannelLoader extends React.Component {
|
||||
}
|
||||
componentDidMount() {
|
||||
/* Initial aysnc loads */
|
||||
AsyncClient.getMe();
|
||||
AsyncClient.getPosts(ChannelStore.getCurrentId());
|
||||
AsyncClient.getChannels(true, true);
|
||||
AsyncClient.getChannelExtraInfo(true);
|
||||
|
||||
@@ -19,10 +19,10 @@ export default class EmailVerify extends React.Component {
|
||||
var resend = '';
|
||||
var resendConfirm = '';
|
||||
if (this.props.isVerified === 'true') {
|
||||
title = global.window.config.SiteName + ' Email Verified';
|
||||
title = global.window.mm_config.SiteName + ' Email Verified';
|
||||
body = <p>Your email has been verified! Click <a href={this.props.teamURL + '?email=' + this.props.userEmail}>here</a> to log in.</p>;
|
||||
} else {
|
||||
title = global.window.config.SiteName + ': You are almost done';
|
||||
title = global.window.mm_config.SiteName + ': You are almost done';
|
||||
body = <p>Please verify your email address. Check your inbox for an email.</p>;
|
||||
resend = (
|
||||
<button
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class InviteMemberModal extends React.Component {
|
||||
emailErrors: {},
|
||||
firstNameErrors: {},
|
||||
lastNameErrors: {},
|
||||
emailEnabled: global.window.config.SendEmailNotifications === 'true'
|
||||
emailEnabled: global.window.mm_config.SendEmailNotifications === 'true'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export default class Login extends React.Component {
|
||||
}
|
||||
handleSubmit(e) {
|
||||
e.preventDefault();
|
||||
let state = {};
|
||||
var state = {};
|
||||
|
||||
const name = this.props.teamName;
|
||||
if (!name) {
|
||||
@@ -49,8 +49,7 @@ export default class Login extends React.Component {
|
||||
this.setState(state);
|
||||
|
||||
Client.loginByEmail(name, email, password,
|
||||
function loggedIn(data) {
|
||||
UserStore.setCurrentUser(data);
|
||||
() => {
|
||||
UserStore.setLastEmail(email);
|
||||
|
||||
const redirect = Utils.getUrlParameter('redirect');
|
||||
@@ -60,7 +59,7 @@ export default class Login extends React.Component {
|
||||
window.location.href = '/' + name + '/channels/town-square';
|
||||
}
|
||||
},
|
||||
function loginFailed(err) {
|
||||
(err) => {
|
||||
if (err.message === 'Login failed because email address has not been verified') {
|
||||
window.location.href = '/verify_email?teamname=' + encodeURIComponent(name) + '&email=' + encodeURIComponent(email);
|
||||
return;
|
||||
@@ -68,7 +67,7 @@ export default class Login extends React.Component {
|
||||
state.serverError = err.message;
|
||||
this.valid = false;
|
||||
this.setState(state);
|
||||
}.bind(this)
|
||||
}
|
||||
);
|
||||
}
|
||||
render() {
|
||||
@@ -95,7 +94,7 @@ export default class Login extends React.Component {
|
||||
}
|
||||
|
||||
let loginMessage = [];
|
||||
if (global.window.config.EnableSignUpWithGitLab === 'true') {
|
||||
if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
|
||||
loginMessage.push(
|
||||
<a
|
||||
className='btn btn-custom-login gitlab'
|
||||
@@ -124,7 +123,7 @@ export default class Login extends React.Component {
|
||||
}
|
||||
|
||||
let emailSignup;
|
||||
if (global.window.config.EnableSignUpWithEmail === 'true') {
|
||||
if (global.window.mm_config.EnableSignUpWithEmail === 'true') {
|
||||
emailSignup = (
|
||||
<div>
|
||||
<div className={'form-group' + errorClass}>
|
||||
@@ -186,7 +185,7 @@ export default class Login extends React.Component {
|
||||
<div className='signup-team__container'>
|
||||
<h5 className='margin--less'>Sign in to:</h5>
|
||||
<h2 className='signup-team__name'>{teamDisplayName}</h2>
|
||||
<h2 className='signup-team__subdomain'>on {global.window.config.SiteName}</h2>
|
||||
<h2 className='signup-team__subdomain'>on {global.window.mm_config.SiteName}</h2>
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
{verifiedBox}
|
||||
<div className={'form-group' + errorClass}>
|
||||
|
||||
@@ -161,7 +161,7 @@ export default class NavbarDropdown extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
if (global.window.config.EnableTeamCreation === 'true') {
|
||||
if (global.window.mm_config.EnableTeamCreation === 'true') {
|
||||
teams.push(
|
||||
<li key='newTeam_li'>
|
||||
<a
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class PasswordResetForm extends React.Component {
|
||||
<div className='signup-team__container'>
|
||||
<h3>Password Reset</h3>
|
||||
<form onSubmit={this.handlePasswordReset}>
|
||||
<p>{'Enter a new password for your ' + this.props.teamDisplayName + ' ' + global.window.config.SiteName + ' account.'}</p>
|
||||
<p>{'Enter a new password for your ' + this.props.teamDisplayName + ' ' + global.window.mm_config.SiteName + ' account.'}</p>
|
||||
<div className={formClass}>
|
||||
<input
|
||||
type='password'
|
||||
|
||||
@@ -159,7 +159,7 @@ export default class Post extends React.Component {
|
||||
var profilePic = null;
|
||||
if (!this.props.hideProfilePic) {
|
||||
let src = '/api/v1/users/' + post.user_id + '/image?time=' + timestamp;
|
||||
if (post.props && post.props.from_webhook && global.window.config.EnablePostIconOverride === 'true') {
|
||||
if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
|
||||
if (post.props.override_icon_url) {
|
||||
src = post.props.override_icon_url;
|
||||
}
|
||||
|
||||
@@ -119,12 +119,12 @@ export default class PostBody extends React.Component {
|
||||
this.setState({youtubeUploader: metadata.channelTitle, youtubeTitle: metadata.title});
|
||||
}
|
||||
|
||||
if (global.window.config.GoogleDeveloperKey && !this.receivedYoutubeData) {
|
||||
if (global.window.mm_config.GoogleDeveloperKey && !this.receivedYoutubeData) {
|
||||
$.ajax({
|
||||
async: true,
|
||||
url: 'https://www.googleapis.com/youtube/v3/videos',
|
||||
type: 'GET',
|
||||
data: {part: 'snippet', id: youtubeId, key: global.window.config.GoogleDeveloperKey},
|
||||
data: {part: 'snippet', id: youtubeId, key: global.window.mm_config.GoogleDeveloperKey},
|
||||
success: success.bind(this)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export default class PostHeader extends React.Component {
|
||||
let botIndicator;
|
||||
|
||||
if (post.props && post.props.from_webhook) {
|
||||
if (post.props.override_username && global.window.config.EnablePostUsernameOverride === 'true') {
|
||||
if (post.props.override_username && global.window.mm_config.EnablePostUsernameOverride === 'true') {
|
||||
userProfile = (
|
||||
<UserProfile
|
||||
userId={post.user_id}
|
||||
|
||||
@@ -121,7 +121,7 @@ export default class RhsRootPost extends React.Component {
|
||||
let botIndicator;
|
||||
|
||||
if (post.props && post.props.from_webhook) {
|
||||
if (post.props.override_username && global.window.config.EnablePostUsernameOverride === 'true') {
|
||||
if (post.props.override_username && global.window.mm_config.EnablePostUsernameOverride === 'true') {
|
||||
userProfile = (
|
||||
<UserProfile
|
||||
userId={post.user_id}
|
||||
@@ -135,7 +135,7 @@ export default class RhsRootPost extends React.Component {
|
||||
}
|
||||
|
||||
let src = '/api/v1/users/' + post.user_id + '/image?time=' + timestamp;
|
||||
if (post.props && post.props.from_webhook && global.window.config.EnablePostIconOverride === 'true') {
|
||||
if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
|
||||
if (post.props.override_icon_url) {
|
||||
src = post.props.override_icon_url;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export default class SettingPicture extends React.Component {
|
||||
>Save</a>
|
||||
);
|
||||
}
|
||||
var helpText = 'Upload a profile picture in either JPG or PNG format, at least ' + global.window.config.ProfileWidth + 'px in width and ' + global.window.config.ProfileHeight + 'px height.';
|
||||
var helpText = 'Upload a profile picture in either JPG or PNG format, at least ' + global.window.mm_config.ProfileWidth + 'px in width and ' + global.window.mm_config.ProfileHeight + 'px height.';
|
||||
|
||||
var self = this;
|
||||
return (
|
||||
|
||||
@@ -265,8 +265,8 @@ export default class Sidebar extends React.Component {
|
||||
const channel = ChannelStore.getCurrent();
|
||||
if (channel) {
|
||||
let currentSiteName = '';
|
||||
if (global.window.config.SiteName != null) {
|
||||
currentSiteName = global.window.config.SiteName;
|
||||
if (global.window.mm_config.SiteName != null) {
|
||||
currentSiteName = global.window.mm_config.SiteName;
|
||||
}
|
||||
|
||||
let currentChannelName = channel.display_name;
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class SidebarHeader extends React.Component {
|
||||
}
|
||||
|
||||
SidebarHeader.defaultProps = {
|
||||
teamDisplayName: global.window.config.SiteName,
|
||||
teamDisplayName: global.window.mm_config.SiteName,
|
||||
teamType: ''
|
||||
};
|
||||
SidebarHeader.propTypes = {
|
||||
|
||||
@@ -92,8 +92,8 @@ export default class SidebarRightMenu extends React.Component {
|
||||
}
|
||||
|
||||
var siteName = '';
|
||||
if (global.window.config.SiteName != null) {
|
||||
siteName = global.window.config.SiteName;
|
||||
if (global.window.mm_config.SiteName != null) {
|
||||
siteName = global.window.mm_config.SiteName;
|
||||
}
|
||||
var teamDisplayName = siteName;
|
||||
if (this.props.teamDisplayName) {
|
||||
|
||||
@@ -14,19 +14,19 @@ export default class TeamSignUp extends React.Component {
|
||||
|
||||
var count = 0;
|
||||
|
||||
if (global.window.config.EnableSignUpWithEmail === 'true') {
|
||||
if (global.window.mm_config.EnableSignUpWithEmail === 'true') {
|
||||
count = count + 1;
|
||||
}
|
||||
|
||||
if (global.window.config.EnableSignUpWithGitLab === 'true') {
|
||||
if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
|
||||
count = count + 1;
|
||||
}
|
||||
|
||||
if (count > 1) {
|
||||
this.state = {page: 'choose'};
|
||||
} else if (global.window.config.EnableSignUpWithEmail === 'true') {
|
||||
} else if (global.window.mm_config.EnableSignUpWithEmail === 'true') {
|
||||
this.state = {page: 'email'};
|
||||
} else if (global.window.config.EnableSignUpWithGitLab === 'true') {
|
||||
} else if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
|
||||
this.state = {page: 'gitlab'};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,30 +82,29 @@ export default class SignupUserComplete extends React.Component {
|
||||
});
|
||||
|
||||
client.createUser(user, this.props.data, this.props.hash,
|
||||
function createUserSuccess() {
|
||||
() => {
|
||||
client.track('signup', 'signup_user_02_complete');
|
||||
|
||||
client.loginByEmail(this.props.teamName, user.email, user.password,
|
||||
function emailLoginSuccess(data) {
|
||||
() => {
|
||||
UserStore.setLastEmail(user.email);
|
||||
UserStore.setCurrentUser(data);
|
||||
if (this.props.hash > 0) {
|
||||
BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: 'finished'}));
|
||||
}
|
||||
window.location.href = '/' + this.props.teamName + '/channels/town-square';
|
||||
}.bind(this),
|
||||
function emailLoginFailure(err) {
|
||||
},
|
||||
(err) => {
|
||||
if (err.message === 'Login failed because email address has not been verified') {
|
||||
window.location.href = '/verify_email?email=' + encodeURIComponent(user.email) + '&teamname=' + encodeURIComponent(this.props.teamName);
|
||||
} else {
|
||||
this.setState({serverError: err.message});
|
||||
}
|
||||
}.bind(this)
|
||||
}
|
||||
);
|
||||
}.bind(this),
|
||||
function createUserFailure(err) {
|
||||
},
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
}.bind(this)
|
||||
}
|
||||
);
|
||||
}
|
||||
render() {
|
||||
@@ -149,7 +148,7 @@ export default class SignupUserComplete extends React.Component {
|
||||
// set up the email entry and hide it if an email was provided
|
||||
var yourEmailIs = '';
|
||||
if (this.state.user.email) {
|
||||
yourEmailIs = <span>Your email address is <strong>{this.state.user.email}</strong>. You'll use this address to sign in to {global.window.config.SiteName}.</span>;
|
||||
yourEmailIs = <span>Your email address is <strong>{this.state.user.email}</strong>. You'll use this address to sign in to {global.window.mm_config.SiteName}.</span>;
|
||||
}
|
||||
|
||||
var emailContainerStyle = 'margin--extra';
|
||||
@@ -177,7 +176,7 @@ export default class SignupUserComplete extends React.Component {
|
||||
);
|
||||
|
||||
var signupMessage = [];
|
||||
if (global.window.config.EnableSignUpWithGitLab === 'true') {
|
||||
if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
|
||||
signupMessage.push(
|
||||
<a
|
||||
className='btn btn-custom-login gitlab'
|
||||
@@ -190,7 +189,7 @@ export default class SignupUserComplete extends React.Component {
|
||||
}
|
||||
|
||||
var emailSignup;
|
||||
if (global.window.config.EnableSignUpWithEmail === 'true') {
|
||||
if (global.window.mm_config.EnableSignUpWithEmail === 'true') {
|
||||
emailSignup = (
|
||||
<div>
|
||||
<div className='inner__content'>
|
||||
@@ -259,7 +258,7 @@ export default class SignupUserComplete extends React.Component {
|
||||
/>
|
||||
<h5 className='margin--less'>Welcome to:</h5>
|
||||
<h2 className='signup-team__name'>{this.props.teamDisplayName}</h2>
|
||||
<h2 className='signup-team__subdomain'>on {global.window.config.SiteName}</h2>
|
||||
<h2 className='signup-team__subdomain'>on {global.window.mm_config.SiteName}</h2>
|
||||
<h4 className='color--light'>Let's create your account</h4>
|
||||
{signupMessage}
|
||||
{emailSignup}
|
||||
|
||||
@@ -8,7 +8,7 @@ export default class ChooseAuthPage extends React.Component {
|
||||
}
|
||||
render() {
|
||||
var buttons = [];
|
||||
if (global.window.config.EnableSignUpWithGitLab === 'true') {
|
||||
if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
|
||||
buttons.push(
|
||||
<a
|
||||
className='btn btn-custom-login gitlab btn-full'
|
||||
@@ -26,7 +26,7 @@ export default class ChooseAuthPage extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (global.window.config.EnableSignUpWithEmail === 'true') {
|
||||
if (global.window.mm_config.EnableSignUpWithEmail === 'true') {
|
||||
buttons.push(
|
||||
<a
|
||||
className='btn btn-custom-login email btn-full'
|
||||
|
||||
@@ -36,15 +36,14 @@ export default class TeamSignupPasswordPage extends React.Component {
|
||||
delete teamSignup.wizard;
|
||||
|
||||
Client.createTeamFromSignup(teamSignup,
|
||||
function success() {
|
||||
() => {
|
||||
Client.track('signup', 'signup_team_08_complete');
|
||||
|
||||
var props = this.props;
|
||||
|
||||
Client.loginByEmail(teamSignup.team.name, teamSignup.team.email, teamSignup.user.password,
|
||||
function loginSuccess(data) {
|
||||
() => {
|
||||
UserStore.setLastEmail(teamSignup.team.email);
|
||||
UserStore.setCurrentUser(data);
|
||||
if (this.props.hash > 0) {
|
||||
BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: 'finished'}));
|
||||
}
|
||||
@@ -54,21 +53,21 @@ export default class TeamSignupPasswordPage extends React.Component {
|
||||
props.updateParent(props.state, true);
|
||||
|
||||
window.location.href = '/' + teamSignup.team.name + '/channels/town-square';
|
||||
}.bind(this),
|
||||
function loginFail(err) {
|
||||
},
|
||||
(err) => {
|
||||
if (err.message === 'Login failed because email address has not been verified') {
|
||||
window.location.href = '/verify_email?email=' + encodeURIComponent(teamSignup.team.email) + '&teamname=' + encodeURIComponent(teamSignup.team.name);
|
||||
} else {
|
||||
this.setState({serverError: err.message});
|
||||
$('#finish-button').button('reset');
|
||||
}
|
||||
}.bind(this)
|
||||
}
|
||||
);
|
||||
}.bind(this),
|
||||
function error(err) {
|
||||
},
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
$('#finish-button').button('reset');
|
||||
}.bind(this)
|
||||
}
|
||||
);
|
||||
}
|
||||
render() {
|
||||
@@ -129,7 +128,7 @@ export default class TeamSignupPasswordPage extends React.Component {
|
||||
Finish
|
||||
</button>
|
||||
</div>
|
||||
<p>By proceeding to create your account and use {global.window.config.SiteName}, you agree to our <a href='/static/help/terms.html'>Terms of Service</a> and <a href='/static/help/privacy.html'>Privacy Policy</a>. If you do not agree, you cannot use {global.window.config.SiteName}.</p>
|
||||
<p>By proceeding to create your account and use {global.window.mm_config.SiteName}, you agree to our <a href='/static/help/terms.html'>Terms of Service</a> and <a href='/static/help/privacy.html'>Privacy Policy</a>. If you do not agree, you cannot use {global.window.mm_config.SiteName}.</p>
|
||||
<div className='margin--extra'>
|
||||
<a
|
||||
href='#'
|
||||
|
||||
@@ -13,7 +13,7 @@ export default class TeamSignupSendInvitesPage extends React.Component {
|
||||
this.submitSkip = this.submitSkip.bind(this);
|
||||
this.keySubmit = this.keySubmit.bind(this);
|
||||
this.state = {
|
||||
emailEnabled: global.window.config.SendEmailNotifications === 'true'
|
||||
emailEnabled: global.window.mm_config.SendEmailNotifications === 'true'
|
||||
};
|
||||
|
||||
if (!this.state.emailEnabled) {
|
||||
|
||||
@@ -110,7 +110,7 @@ export default class TeamSignupWelcomePage extends React.Component {
|
||||
src='/static/images/logo.png'
|
||||
/>
|
||||
<h3 className='sub-heading'>Welcome to:</h3>
|
||||
<h1 className='margin--top-none'>{global.window.config.SiteName}</h1>
|
||||
<h1 className='margin--top-none'>{global.window.mm_config.SiteName}</h1>
|
||||
</p>
|
||||
<p className='margin--less'>Let's set up your new team</p>
|
||||
<p>
|
||||
|
||||
@@ -71,7 +71,7 @@ export default class UserProfile extends React.Component {
|
||||
width='128'
|
||||
/>
|
||||
);
|
||||
if (!global.window.config.ShowEmailAddress === 'true') {
|
||||
if (!global.window.mm_config.ShowEmailAddress === 'true') {
|
||||
dataContent.push(<div className='text-nowrap'>{'Email not shared'}</div>);
|
||||
} else {
|
||||
dataContent.push(
|
||||
|
||||
@@ -122,7 +122,7 @@ export default class UserSettingsGeneralTab extends React.Component {
|
||||
() => {
|
||||
this.updateSection('');
|
||||
AsyncClient.getMe();
|
||||
const verificationEnabled = global.window.config.SendEmailNotifications === 'true' && global.window.config.RequireEmailVerification === 'true' && emailUpdated;
|
||||
const verificationEnabled = global.window.mm_config.SendEmailNotifications === 'true' && global.window.mm_config.RequireEmailVerification === 'true' && emailUpdated;
|
||||
|
||||
if (verificationEnabled) {
|
||||
ErrorStore.storeLastError({message: 'Check your email at ' + user.email + ' to verify the address.'});
|
||||
@@ -451,8 +451,8 @@ export default class UserSettingsGeneralTab extends React.Component {
|
||||
}
|
||||
var emailSection;
|
||||
if (this.props.activeSection === 'email') {
|
||||
const emailEnabled = global.window.config.SendEmailNotifications === 'true';
|
||||
const emailVerificationEnabled = global.window.config.RequireEmailVerification === 'true';
|
||||
const emailEnabled = global.window.mm_config.SendEmailNotifications === 'true';
|
||||
const emailVerificationEnabled = global.window.mm_config.RequireEmailVerification === 'true';
|
||||
let helpText = 'Email is used for notifications, and requires verification if changed.';
|
||||
|
||||
if (!emailEnabled) {
|
||||
|
||||
@@ -35,10 +35,10 @@ export default class UserSettingsModal extends React.Component {
|
||||
tabs.push({name: 'security', uiName: 'Security', icon: 'glyphicon glyphicon-lock'});
|
||||
tabs.push({name: 'notifications', uiName: 'Notifications', icon: 'glyphicon glyphicon-exclamation-sign'});
|
||||
tabs.push({name: 'appearance', uiName: 'Appearance', icon: 'glyphicon glyphicon-wrench'});
|
||||
if (global.window.config.EnableOAuthServiceProvider === 'true') {
|
||||
if (global.window.mm_config.EnableOAuthServiceProvider === 'true') {
|
||||
tabs.push({name: 'developer', uiName: 'Developer', icon: 'glyphicon glyphicon-th'});
|
||||
}
|
||||
if (global.window.config.EnableIncomingWebhooks === 'true') {
|
||||
if (global.window.mm_config.EnableIncomingWebhooks === 'true') {
|
||||
tabs.push({name: 'integrations', uiName: 'Integrations', icon: 'glyphicon glyphicon-transfer'});
|
||||
}
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ export default class NotificationsTab extends React.Component {
|
||||
</label>
|
||||
<br/>
|
||||
</div>
|
||||
<div><br/>{'Email notifications are sent for mentions and direct messages after you’ve been offline for more than 60 seconds or away from ' + global.window.config.SiteName + ' for more than 5 minutes.'}</div>
|
||||
<div><br/>{'Email notifications are sent for mentions and direct messages after you’ve been offline for more than 60 seconds or away from ' + global.window.mm_config.SiteName + ' for more than 5 minutes.'}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export default class ViewImagePopoverBar extends React.Component {
|
||||
}
|
||||
render() {
|
||||
var publicLink = '';
|
||||
if (global.window.config.EnablePublicLink === 'true') {
|
||||
if (global.window.mm_config.EnablePublicLink === 'true') {
|
||||
publicLink = (
|
||||
<div>
|
||||
<a
|
||||
|
||||
@@ -35,25 +35,17 @@ var RemovedFromChannelModal = require('../components/removed_from_channel_modal.
|
||||
var FileUploadOverlay = require('../components/file_upload_overlay.jsx');
|
||||
var RegisterAppModal = require('../components/register_app_modal.jsx');
|
||||
var ImportThemeModal = require('../components/user_settings/import_theme_modal.jsx');
|
||||
var TeamStore = require('../stores/team_store.jsx');
|
||||
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
var ActionTypes = Constants.ActionTypes;
|
||||
|
||||
function setupChannelPage(props) {
|
||||
TeamStore.setCurrentId(props.TeamId);
|
||||
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.CLICK_CHANNEL,
|
||||
name: props.ChannelName,
|
||||
id: props.ChannelId
|
||||
});
|
||||
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.CLICK_TEAM,
|
||||
id: props.TeamId
|
||||
});
|
||||
|
||||
// ChannelLoader must be rendered first
|
||||
ReactDOM.render(
|
||||
<ChannelLoader/>,
|
||||
@@ -234,7 +226,7 @@ function setupChannelPage(props) {
|
||||
document.getElementById('register_app_modal')
|
||||
);
|
||||
|
||||
if (global.window.config.SendEmailNotifications === 'false') {
|
||||
if (global.window.mm_config.SendEmailNotifications === 'false') {
|
||||
ErrorStore.storeLastError({message: 'Preview Mode: Email notifications have not been configured'});
|
||||
ErrorStore.emitChange();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
var UserStore;
|
||||
function getPrefix() {
|
||||
if (!UserStore) {
|
||||
UserStore = require('./user_store.jsx'); //eslint-disable-line global-require
|
||||
if (global.window.mm_user) {
|
||||
return global.window.mm_user.id + '_';
|
||||
}
|
||||
return UserStore.getCurrentId() + '_';
|
||||
|
||||
return 'unknown_';
|
||||
}
|
||||
|
||||
class BrowserStoreClass {
|
||||
@@ -17,32 +17,50 @@ class BrowserStoreClass {
|
||||
this.setGlobalItem = this.setGlobalItem.bind(this);
|
||||
this.getGlobalItem = this.getGlobalItem.bind(this);
|
||||
this.removeGlobalItem = this.removeGlobalItem.bind(this);
|
||||
this.clear = this.clear.bind(this);
|
||||
this.actionOnItemsWithPrefix = this.actionOnItemsWithPrefix.bind(this);
|
||||
this.actionOnGlobalItemsWithPrefix = this.actionOnGlobalItemsWithPrefix.bind(this);
|
||||
this.isLocalStorageSupported = this.isLocalStorageSupported.bind(this);
|
||||
this.getLastServerVersion = this.getLastServerVersion.bind(this);
|
||||
this.setLastServerVersion = this.setLastServerVersion.bind(this);
|
||||
this.clear = this.clear.bind(this);
|
||||
|
||||
var currentVersion = localStorage.getItem('local_storage_version');
|
||||
if (currentVersion !== global.window.config.Version) {
|
||||
this.clear();
|
||||
localStorage.setItem('local_storage_version', global.window.config.Version);
|
||||
var currentVersion = sessionStorage.getItem('storage_version');
|
||||
if (currentVersion !== global.window.mm_config.Version) {
|
||||
sessionStorage.clear();
|
||||
sessionStorage.setItem('storage_version', global.window.mm_config.Version);
|
||||
}
|
||||
}
|
||||
|
||||
getItem(name, defaultValue) {
|
||||
return this.getGlobalItem(getPrefix() + name, defaultValue);
|
||||
var result = null;
|
||||
try {
|
||||
result = JSON.parse(sessionStorage.getItem(getPrefix() + name));
|
||||
} catch (err) {
|
||||
result = null;
|
||||
}
|
||||
|
||||
if (result === null && typeof defaultValue !== 'undefined') {
|
||||
result = defaultValue;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
setItem(name, value) {
|
||||
this.setGlobalItem(getPrefix() + name, value);
|
||||
sessionStorage.setItem(getPrefix() + name, JSON.stringify(value));
|
||||
}
|
||||
|
||||
removeItem(name) {
|
||||
localStorage.removeItem(getPrefix() + name);
|
||||
sessionStorage.removeItem(getPrefix() + name);
|
||||
}
|
||||
|
||||
setGlobalItem(name, value) {
|
||||
try {
|
||||
localStorage.setItem(name, JSON.stringify(value));
|
||||
if (this.isLocalStorageSupported()) {
|
||||
localStorage.setItem(name, JSON.stringify(value));
|
||||
} else {
|
||||
sessionStorage.setItem(name, JSON.stringify(value));
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('An error occurred while setting local storage, clearing all props'); //eslint-disable-line no-console
|
||||
localStorage.clear();
|
||||
@@ -53,7 +71,11 @@ class BrowserStoreClass {
|
||||
getGlobalItem(name, defaultValue) {
|
||||
var result = null;
|
||||
try {
|
||||
result = JSON.parse(localStorage.getItem(name));
|
||||
if (this.isLocalStorageSupported()) {
|
||||
result = JSON.parse(localStorage.getItem(name));
|
||||
} else {
|
||||
result = JSON.parse(sessionStorage.getItem(name));
|
||||
}
|
||||
} catch (err) {
|
||||
result = null;
|
||||
}
|
||||
@@ -66,19 +88,26 @@ class BrowserStoreClass {
|
||||
}
|
||||
|
||||
removeGlobalItem(name) {
|
||||
localStorage.removeItem(name);
|
||||
if (this.isLocalStorageSupported()) {
|
||||
localStorage.removeItem(name);
|
||||
} else {
|
||||
sessionStorage.removeItem(name);
|
||||
}
|
||||
}
|
||||
|
||||
clear() {
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
getLastServerVersion() {
|
||||
return sessionStorage.getItem('last_server_version');
|
||||
}
|
||||
|
||||
setLastServerVersion(version) {
|
||||
sessionStorage.setItem('last_server_version', version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preforms the given action on each item that has the given prefix
|
||||
* Signature for action is action(key, value)
|
||||
*/
|
||||
actionOnItemsWithPrefix(prefix, action) {
|
||||
actionOnGlobalItemsWithPrefix(prefix, action) {
|
||||
var globalPrefix = getPrefix();
|
||||
var globalPrefixiLen = globalPrefix.length;
|
||||
for (var key in localStorage) {
|
||||
@@ -89,6 +118,21 @@ class BrowserStoreClass {
|
||||
}
|
||||
}
|
||||
|
||||
actionOnItemsWithPrefix(prefix, action) {
|
||||
var globalPrefix = getPrefix();
|
||||
var globalPrefixiLen = globalPrefix.length;
|
||||
for (var key in sessionStorage) {
|
||||
if (key.lastIndexOf(globalPrefix + prefix, 0) === 0) {
|
||||
var userkey = key.substring(globalPrefixiLen);
|
||||
action(userkey, this.getGlobalItem(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clear() {
|
||||
sessionStorage.clear();
|
||||
}
|
||||
|
||||
isLocalStorageSupported() {
|
||||
try {
|
||||
sessionStorage.setItem('testSession', '1');
|
||||
|
||||
@@ -34,9 +34,11 @@ class ErrorStoreClass extends EventEmitter {
|
||||
removeChangeListener(callback) {
|
||||
this.removeListener(CHANGE_EVENT, callback);
|
||||
}
|
||||
|
||||
handledError() {
|
||||
BrowserStore.removeItem('last_error');
|
||||
}
|
||||
|
||||
getLastError() {
|
||||
return BrowserStore.getItem('last_error');
|
||||
}
|
||||
|
||||
@@ -283,10 +283,10 @@ class PostStoreClass extends EventEmitter {
|
||||
return 0;
|
||||
});
|
||||
|
||||
BrowserStore.setItem('pending_posts_' + channelId, postList);
|
||||
BrowserStore.setGlobalItem('pending_posts_' + channelId, postList);
|
||||
}
|
||||
getPendingPosts(channelId) {
|
||||
return BrowserStore.getItem('pending_posts_' + channelId);
|
||||
return BrowserStore.getGlobalItem('pending_posts_' + channelId);
|
||||
}
|
||||
storeUnseenDeletedPost(post) {
|
||||
var posts = this.getUnseenDeletedPosts(post.channel_id);
|
||||
@@ -330,7 +330,7 @@ class PostStoreClass extends EventEmitter {
|
||||
this.pStorePendingPosts(channelId, postList);
|
||||
}
|
||||
clearPendingPosts() {
|
||||
BrowserStore.actionOnItemsWithPrefix('pending_posts_', function clearPending(key) {
|
||||
BrowserStore.actionOnGlobalItemsWithPrefix('pending_posts_', function clearPending(key) {
|
||||
BrowserStore.removeItem(key);
|
||||
});
|
||||
}
|
||||
@@ -373,26 +373,26 @@ class PostStoreClass extends EventEmitter {
|
||||
}
|
||||
storeCurrentDraft(draft) {
|
||||
var channelId = ChannelStore.getCurrentId();
|
||||
BrowserStore.setItem('draft_' + channelId, draft);
|
||||
BrowserStore.setGlobalItem('draft_' + channelId, draft);
|
||||
}
|
||||
getCurrentDraft() {
|
||||
var channelId = ChannelStore.getCurrentId();
|
||||
return this.getDraft(channelId);
|
||||
}
|
||||
storeDraft(channelId, draft) {
|
||||
BrowserStore.setItem('draft_' + channelId, draft);
|
||||
BrowserStore.setGlobalItem('draft_' + channelId, draft);
|
||||
}
|
||||
getDraft(channelId) {
|
||||
return BrowserStore.getItem('draft_' + channelId, this.getEmptyDraft());
|
||||
return BrowserStore.getGlobalItem('draft_' + channelId, this.getEmptyDraft());
|
||||
}
|
||||
storeCommentDraft(parentPostId, draft) {
|
||||
BrowserStore.setItem('comment_draft_' + parentPostId, draft);
|
||||
BrowserStore.setGlobalItem('comment_draft_' + parentPostId, draft);
|
||||
}
|
||||
getCommentDraft(parentPostId) {
|
||||
return BrowserStore.getItem('comment_draft_' + parentPostId, this.getEmptyDraft());
|
||||
return BrowserStore.getGlobalItem('comment_draft_' + parentPostId, this.getEmptyDraft());
|
||||
}
|
||||
clearDraftUploads() {
|
||||
BrowserStore.actionOnItemsWithPrefix('draft_', function clearUploads(key, value) {
|
||||
BrowserStore.actionOnGlobalItemsWithPrefix('draft_', function clearUploads(key, value) {
|
||||
if (value) {
|
||||
value.uploadsInProgress = [];
|
||||
BrowserStore.setItem(key, value);
|
||||
@@ -400,7 +400,7 @@ class PostStoreClass extends EventEmitter {
|
||||
});
|
||||
}
|
||||
clearCommentDraftUploads() {
|
||||
BrowserStore.actionOnItemsWithPrefix('comment_draft_', function clearUploads(key, value) {
|
||||
BrowserStore.actionOnGlobalItemsWithPrefix('comment_draft_', function clearUploads(key, value) {
|
||||
if (value) {
|
||||
value.uploadsInProgress = [];
|
||||
BrowserStore.setItem(key, value);
|
||||
|
||||
@@ -28,29 +28,31 @@ class TeamStoreClass extends EventEmitter {
|
||||
this.get = this.get.bind(this);
|
||||
this.getByName = this.getByName.bind(this);
|
||||
this.getAll = this.getAll.bind(this);
|
||||
this.setCurrentId = this.setCurrentId.bind(this);
|
||||
this.getCurrentId = this.getCurrentId.bind(this);
|
||||
this.getCurrent = this.getCurrent.bind(this);
|
||||
this.getCurrentTeamUrl = this.getCurrentTeamUrl.bind(this);
|
||||
this.storeTeam = this.storeTeam.bind(this);
|
||||
this.pStoreTeams = this.pStoreTeams.bind(this);
|
||||
this.pGetTeams = this.pGetTeams.bind(this);
|
||||
this.saveTeam = this.saveTeam.bind(this);
|
||||
}
|
||||
|
||||
emitChange() {
|
||||
this.emit(CHANGE_EVENT);
|
||||
}
|
||||
|
||||
addChangeListener(callback) {
|
||||
this.on(CHANGE_EVENT, callback);
|
||||
}
|
||||
|
||||
removeChangeListener(callback) {
|
||||
this.removeListener(CHANGE_EVENT, callback);
|
||||
}
|
||||
|
||||
get(id) {
|
||||
var c = this.pGetTeams();
|
||||
var c = this.getAll();
|
||||
return c[id];
|
||||
}
|
||||
|
||||
getByName(name) {
|
||||
var t = this.pGetTeams();
|
||||
var t = this.getAll();
|
||||
|
||||
for (var id in t) {
|
||||
if (t[id].name === name) {
|
||||
@@ -60,59 +62,51 @@ class TeamStoreClass extends EventEmitter {
|
||||
|
||||
return null;
|
||||
}
|
||||
getAll() {
|
||||
return this.pGetTeams();
|
||||
}
|
||||
setCurrentId(id) {
|
||||
if (id === null) {
|
||||
BrowserStore.removeItem('current_team_id');
|
||||
} else {
|
||||
BrowserStore.setItem('current_team_id', id);
|
||||
}
|
||||
}
|
||||
getCurrentId() {
|
||||
return BrowserStore.getItem('current_team_id');
|
||||
}
|
||||
getCurrent() {
|
||||
var currentId = this.getCurrentId();
|
||||
|
||||
if (currentId !== null) {
|
||||
return this.get(currentId);
|
||||
getAll() {
|
||||
return BrowserStore.getItem('user_teams', {});
|
||||
}
|
||||
|
||||
getCurrentId() {
|
||||
var team = global.window.mm_team;
|
||||
|
||||
if (team) {
|
||||
return team.id;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
getCurrent() {
|
||||
if (global.window.mm_team != null && this.get(global.window.mm_team.id) == null) {
|
||||
this.saveTeam(global.window.mm_team);
|
||||
}
|
||||
|
||||
return global.window.mm_team;
|
||||
}
|
||||
|
||||
getCurrentTeamUrl() {
|
||||
if (this.getCurrent()) {
|
||||
return getWindowLocationOrigin() + '/' + this.getCurrent().name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
storeTeam(team) {
|
||||
var teams = this.pGetTeams();
|
||||
|
||||
saveTeam(team) {
|
||||
var teams = this.getAll();
|
||||
teams[team.id] = team;
|
||||
this.pStoreTeams(teams);
|
||||
}
|
||||
pStoreTeams(teams) {
|
||||
BrowserStore.setItem('user_teams', teams);
|
||||
}
|
||||
pGetTeams() {
|
||||
return BrowserStore.getItem('user_teams', {});
|
||||
}
|
||||
}
|
||||
|
||||
var TeamStore = new TeamStoreClass();
|
||||
|
||||
TeamStore.dispatchToken = AppDispatcher.register(function registry(payload) {
|
||||
TeamStore.dispatchToken = AppDispatcher.register((payload) => {
|
||||
var action = payload.action;
|
||||
|
||||
switch (action.type) {
|
||||
case ActionTypes.CLICK_TEAM:
|
||||
TeamStore.setCurrentId(action.id);
|
||||
TeamStore.emitChange();
|
||||
break;
|
||||
|
||||
case ActionTypes.RECIEVED_TEAM:
|
||||
TeamStore.storeTeam(action.team);
|
||||
TeamStore.saveTeam(action.team);
|
||||
TeamStore.emitChange();
|
||||
break;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var client = require('../utils/client.jsx');
|
||||
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
var ActionTypes = Constants.ActionTypes;
|
||||
@@ -38,13 +37,11 @@ class UserStoreClass extends EventEmitter {
|
||||
this.emitToggleImportModal = this.emitToggleImportModal.bind(this);
|
||||
this.addImportModalListener = this.addImportModalListener.bind(this);
|
||||
this.removeImportModalListener = this.removeImportModalListener.bind(this);
|
||||
this.setCurrentId = this.setCurrentId.bind(this);
|
||||
this.getCurrentId = this.getCurrentId.bind(this);
|
||||
this.getCurrentUser = this.getCurrentUser.bind(this);
|
||||
this.setCurrentUser = this.setCurrentUser.bind(this);
|
||||
this.getLastEmail = this.getLastEmail.bind(this);
|
||||
this.setLastEmail = this.setLastEmail.bind(this);
|
||||
this.removeCurrentUser = this.removeCurrentUser.bind(this);
|
||||
this.hasProfile = this.hasProfile.bind(this);
|
||||
this.getProfile = this.getProfile.bind(this);
|
||||
this.getProfileByUsername = this.getProfileByUsername.bind(this);
|
||||
@@ -52,9 +49,6 @@ class UserStoreClass extends EventEmitter {
|
||||
this.getProfiles = this.getProfiles.bind(this);
|
||||
this.getActiveOnlyProfiles = this.getActiveOnlyProfiles.bind(this);
|
||||
this.saveProfile = this.saveProfile.bind(this);
|
||||
this.pStoreProfiles = this.pStoreProfiles.bind(this);
|
||||
this.pGetProfiles = this.pGetProfiles.bind(this);
|
||||
this.pGetProfilesUsernameMap = this.pGetProfilesUsernameMap.bind(this);
|
||||
this.setSessions = this.setSessions.bind(this);
|
||||
this.getSessions = this.getSessions.bind(this);
|
||||
this.setAudits = this.setAudits.bind(this);
|
||||
@@ -62,138 +56,155 @@ class UserStoreClass extends EventEmitter {
|
||||
this.setTeams = this.setTeams.bind(this);
|
||||
this.getTeams = this.getTeams.bind(this);
|
||||
this.getCurrentMentionKeys = this.getCurrentMentionKeys.bind(this);
|
||||
this.getLastVersion = this.getLastVersion.bind(this);
|
||||
this.setLastVersion = this.setLastVersion.bind(this);
|
||||
this.setStatuses = this.setStatuses.bind(this);
|
||||
this.pSetStatuses = this.pSetStatuses.bind(this);
|
||||
this.setStatus = this.setStatus.bind(this);
|
||||
this.getStatuses = this.getStatuses.bind(this);
|
||||
this.getStatus = this.getStatus.bind(this);
|
||||
|
||||
this.gCurrentId = null;
|
||||
}
|
||||
|
||||
emitChange(userId) {
|
||||
this.emit(CHANGE_EVENT, userId);
|
||||
}
|
||||
|
||||
addChangeListener(callback) {
|
||||
this.on(CHANGE_EVENT, callback);
|
||||
}
|
||||
|
||||
removeChangeListener(callback) {
|
||||
this.removeListener(CHANGE_EVENT, callback);
|
||||
}
|
||||
|
||||
emitSessionsChange() {
|
||||
this.emit(CHANGE_EVENT_SESSIONS);
|
||||
}
|
||||
|
||||
addSessionsChangeListener(callback) {
|
||||
this.on(CHANGE_EVENT_SESSIONS, callback);
|
||||
}
|
||||
|
||||
removeSessionsChangeListener(callback) {
|
||||
this.removeListener(CHANGE_EVENT_SESSIONS, callback);
|
||||
}
|
||||
|
||||
emitAuditsChange() {
|
||||
this.emit(CHANGE_EVENT_AUDITS);
|
||||
}
|
||||
|
||||
addAuditsChangeListener(callback) {
|
||||
this.on(CHANGE_EVENT_AUDITS, callback);
|
||||
}
|
||||
|
||||
removeAuditsChangeListener(callback) {
|
||||
this.removeListener(CHANGE_EVENT_AUDITS, callback);
|
||||
}
|
||||
|
||||
emitTeamsChange() {
|
||||
this.emit(CHANGE_EVENT_TEAMS);
|
||||
}
|
||||
|
||||
addTeamsChangeListener(callback) {
|
||||
this.on(CHANGE_EVENT_TEAMS, callback);
|
||||
}
|
||||
|
||||
removeTeamsChangeListener(callback) {
|
||||
this.removeListener(CHANGE_EVENT_TEAMS, callback);
|
||||
}
|
||||
|
||||
emitStatusesChange() {
|
||||
this.emit(CHANGE_EVENT_STATUSES);
|
||||
}
|
||||
|
||||
addStatusesChangeListener(callback) {
|
||||
this.on(CHANGE_EVENT_STATUSES, callback);
|
||||
}
|
||||
|
||||
removeStatusesChangeListener(callback) {
|
||||
this.removeListener(CHANGE_EVENT_STATUSES, callback);
|
||||
}
|
||||
|
||||
emitToggleImportModal(value) {
|
||||
this.emit(TOGGLE_IMPORT_MODAL_EVENT, value);
|
||||
}
|
||||
|
||||
addImportModalListener(callback) {
|
||||
this.on(TOGGLE_IMPORT_MODAL_EVENT, callback);
|
||||
}
|
||||
|
||||
removeImportModalListener(callback) {
|
||||
this.removeListener(TOGGLE_IMPORT_MODAL_EVENT, callback);
|
||||
}
|
||||
setCurrentId(id) {
|
||||
this.gCurrentId = id;
|
||||
if (id == null) {
|
||||
BrowserStore.removeGlobalItem('current_user_id');
|
||||
|
||||
getCurrentUser() {
|
||||
if (this.getProfiles()[global.window.mm_user.id] == null) {
|
||||
this.saveProfile(global.window.mm_user);
|
||||
}
|
||||
|
||||
return global.window.mm_user;
|
||||
}
|
||||
|
||||
setCurrentUser(user) {
|
||||
var oldUser = global.window.mm_user;
|
||||
|
||||
if (oldUser.id === user.id) {
|
||||
global.window.mm_user = user;
|
||||
this.saveProfile(user);
|
||||
} else {
|
||||
BrowserStore.setGlobalItem('current_user_id', id);
|
||||
throw new Error('Problem with setCurrentUser old_user_id=' + oldUser.id + ' new_user_id=' + user.id);
|
||||
}
|
||||
}
|
||||
getCurrentId(skipFetch) {
|
||||
var currentId = this.gCurrentId;
|
||||
|
||||
if (currentId == null) {
|
||||
currentId = BrowserStore.getGlobalItem('current_user_id');
|
||||
this.gCurrentId = currentId;
|
||||
getCurrentId() {
|
||||
var user = global.window.mm_user;
|
||||
|
||||
if (user) {
|
||||
return user.id;
|
||||
}
|
||||
|
||||
// this is a special case to force fetch the
|
||||
// current user if it's missing
|
||||
// it's synchronous to block rendering
|
||||
if (currentId == null && !skipFetch) {
|
||||
var me = client.getMeSynchronous();
|
||||
if (me != null) {
|
||||
this.setCurrentUser(me);
|
||||
currentId = me.id;
|
||||
return null;
|
||||
}
|
||||
|
||||
getLastEmail() {
|
||||
return BrowserStore.getGlobalItem('last_email', '');
|
||||
}
|
||||
|
||||
setLastEmail(email) {
|
||||
BrowserStore.setGlobalItem('last_email', email);
|
||||
}
|
||||
|
||||
hasProfile(userId) {
|
||||
return this.getProfiles()[userId] != null;
|
||||
}
|
||||
|
||||
getProfile(userId) {
|
||||
return this.getProfiles()[userId];
|
||||
}
|
||||
|
||||
getProfileByUsername(username) {
|
||||
return this.getProfilesUsernameMap()[username];
|
||||
}
|
||||
|
||||
getProfilesUsernameMap() {
|
||||
var profileUsernameMap = {};
|
||||
|
||||
var profiles = this.getProfiles();
|
||||
for (var key in profiles) {
|
||||
if (profiles.hasOwnProperty(key)) {
|
||||
var profile = profiles[key];
|
||||
profileUsernameMap[profile.username] = profile;
|
||||
}
|
||||
}
|
||||
|
||||
return currentId;
|
||||
return profileUsernameMap;
|
||||
}
|
||||
getCurrentUser() {
|
||||
if (this.getCurrentId() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.pGetProfiles()[this.getCurrentId()];
|
||||
}
|
||||
setCurrentUser(user) {
|
||||
this.setCurrentId(user.id);
|
||||
this.saveProfile(user);
|
||||
}
|
||||
getLastEmail() {
|
||||
return BrowserStore.getItem('last_email', '');
|
||||
}
|
||||
setLastEmail(email) {
|
||||
BrowserStore.setItem('last_email', email);
|
||||
}
|
||||
removeCurrentUser() {
|
||||
this.setCurrentId(null);
|
||||
}
|
||||
hasProfile(userId) {
|
||||
return this.pGetProfiles()[userId] != null;
|
||||
}
|
||||
getProfile(userId) {
|
||||
return this.pGetProfiles()[userId];
|
||||
}
|
||||
getProfileByUsername(username) {
|
||||
return this.pGetProfilesUsernameMap()[username];
|
||||
}
|
||||
getProfilesUsernameMap() {
|
||||
return this.pGetProfilesUsernameMap();
|
||||
}
|
||||
getProfiles() {
|
||||
return this.pGetProfiles();
|
||||
return BrowserStore.getItem('profiles', {});
|
||||
}
|
||||
|
||||
getActiveOnlyProfiles() {
|
||||
var active = {};
|
||||
var current = this.pGetProfiles();
|
||||
var current = this.getProfiles();
|
||||
|
||||
for (var key in current) {
|
||||
if (current[key].delete_at === 0) {
|
||||
@@ -203,45 +214,37 @@ class UserStoreClass extends EventEmitter {
|
||||
|
||||
return active;
|
||||
}
|
||||
|
||||
saveProfile(profile) {
|
||||
var ps = this.pGetProfiles();
|
||||
var ps = this.getProfiles();
|
||||
ps[profile.id] = profile;
|
||||
this.pStoreProfiles(ps);
|
||||
}
|
||||
pStoreProfiles(profiles) {
|
||||
BrowserStore.setItem('profiles', profiles);
|
||||
var profileUsernameMap = {};
|
||||
for (var id in profiles) {
|
||||
if (profiles.hasOwnProperty(id)) {
|
||||
profileUsernameMap[profiles[id].username] = profiles[id];
|
||||
}
|
||||
}
|
||||
BrowserStore.setItem('profileUsernameMap', profileUsernameMap);
|
||||
}
|
||||
pGetProfiles() {
|
||||
return BrowserStore.getItem('profiles', {});
|
||||
}
|
||||
pGetProfilesUsernameMap() {
|
||||
return BrowserStore.getItem('profileUsernameMap', {});
|
||||
BrowserStore.setItem('profiles', ps);
|
||||
}
|
||||
|
||||
setSessions(sessions) {
|
||||
BrowserStore.setItem('sessions', sessions);
|
||||
}
|
||||
|
||||
getSessions() {
|
||||
return BrowserStore.getItem('sessions', {loading: true});
|
||||
}
|
||||
|
||||
setAudits(audits) {
|
||||
BrowserStore.setItem('audits', audits);
|
||||
}
|
||||
|
||||
getAudits() {
|
||||
return BrowserStore.getItem('audits', {loading: true});
|
||||
}
|
||||
|
||||
setTeams(teams) {
|
||||
BrowserStore.setItem('teams', teams);
|
||||
}
|
||||
|
||||
getTeams() {
|
||||
return BrowserStore.getItem('teams', []);
|
||||
}
|
||||
|
||||
getCurrentMentionKeys() {
|
||||
var user = this.getCurrentUser();
|
||||
|
||||
@@ -269,28 +272,27 @@ class UserStoreClass extends EventEmitter {
|
||||
|
||||
return keys;
|
||||
}
|
||||
getLastVersion() {
|
||||
return BrowserStore.getItem('last_version', '');
|
||||
}
|
||||
setLastVersion(version) {
|
||||
BrowserStore.setItem('last_version', version);
|
||||
}
|
||||
|
||||
setStatuses(statuses) {
|
||||
this.pSetStatuses(statuses);
|
||||
this.emitStatusesChange();
|
||||
}
|
||||
|
||||
pSetStatuses(statuses) {
|
||||
BrowserStore.setItem('statuses', statuses);
|
||||
}
|
||||
|
||||
setStatus(userId, status) {
|
||||
var statuses = this.getStatuses();
|
||||
statuses[userId] = status;
|
||||
this.pSetStatuses(statuses);
|
||||
this.emitStatusesChange();
|
||||
}
|
||||
|
||||
getStatuses() {
|
||||
return BrowserStore.getItem('statuses', {});
|
||||
}
|
||||
|
||||
getStatus(id) {
|
||||
return this.getStatuses()[id];
|
||||
}
|
||||
@@ -299,7 +301,7 @@ class UserStoreClass extends EventEmitter {
|
||||
var UserStore = new UserStoreClass();
|
||||
UserStore.setMaxListeners(0);
|
||||
|
||||
UserStore.dispatchToken = AppDispatcher.register(function registry(payload) {
|
||||
UserStore.dispatchToken = AppDispatcher.register((payload) => {
|
||||
var action = payload.action;
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
var client = require('./client.jsx');
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
var BrowserStore = require('../stores/browser_store.jsx');
|
||||
var ChannelStore = require('../stores/channel_store.jsx');
|
||||
var PostStore = require('../stores/post_store.jsx');
|
||||
var UserStore = require('../stores/user_store.jsx');
|
||||
@@ -50,18 +51,18 @@ export function getChannels(force, updateLastViewed, checkVersion) {
|
||||
callTracker.getChannels = utils.getTimestamp();
|
||||
|
||||
client.getChannels(
|
||||
function getChannelsSuccess(data, textStatus, xhr) {
|
||||
(data, textStatus, xhr) => {
|
||||
callTracker.getChannels = 0;
|
||||
|
||||
if (checkVersion) {
|
||||
var serverVersion = xhr.getResponseHeader('X-Version-ID');
|
||||
|
||||
if (!UserStore.getLastVersion()) {
|
||||
UserStore.setLastVersion(serverVersion);
|
||||
if (!BrowserStore.getLastServerVersion()) {
|
||||
BrowserStore.setLastServerVersion(serverVersion);
|
||||
}
|
||||
|
||||
if (serverVersion !== UserStore.getLastVersion()) {
|
||||
UserStore.setLastVersion(serverVersion);
|
||||
if (serverVersion !== BrowserStore.getLastServerVersion()) {
|
||||
BrowserStore.setLastServerVersion(serverVersion);
|
||||
window.location.href = window.location.href;
|
||||
console.log('Detected version update refreshing the page'); //eslint-disable-line no-console
|
||||
}
|
||||
@@ -77,7 +78,7 @@ export function getChannels(force, updateLastViewed, checkVersion) {
|
||||
members: data.members
|
||||
});
|
||||
},
|
||||
function getChannelsFailure(err) {
|
||||
(err) => {
|
||||
callTracker.getChannels = 0;
|
||||
dispatchError(err, 'getChannels');
|
||||
}
|
||||
@@ -566,8 +567,8 @@ export function getMe() {
|
||||
}
|
||||
|
||||
callTracker.getMe = utils.getTimestamp();
|
||||
client.getMeSynchronous(
|
||||
function getMeSyncSuccess(data, textStatus, xhr) {
|
||||
client.getMe(
|
||||
(data, textStatus, xhr) => {
|
||||
callTracker.getMe = 0;
|
||||
|
||||
if (xhr.status === 304 || !data) {
|
||||
@@ -579,7 +580,7 @@ export function getMe() {
|
||||
me: data
|
||||
});
|
||||
},
|
||||
function getMeSyncFailure(err) {
|
||||
(err) => {
|
||||
callTracker.getMe = 0;
|
||||
dispatchError(err, 'getMe');
|
||||
}
|
||||
|
||||
@@ -232,6 +232,7 @@ export function logout() {
|
||||
track('api', 'api_users_logout');
|
||||
var currentTeamUrl = TeamStore.getCurrentTeamUrl();
|
||||
BrowserStore.clear();
|
||||
ErrorStore.storeLastError(null);
|
||||
window.location.href = currentTeamUrl + '/logout';
|
||||
}
|
||||
|
||||
@@ -385,10 +386,9 @@ export function getAllTeams(success, error) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getMeSynchronous(success, error) {
|
||||
export function getMe(success, error) {
|
||||
var currentUser = null;
|
||||
$.ajax({
|
||||
async: false,
|
||||
cache: false,
|
||||
url: '/api/v1/users/me',
|
||||
dataType: 'json',
|
||||
@@ -402,7 +402,7 @@ export function getMeSynchronous(success, error) {
|
||||
},
|
||||
error: function onError(xhr, status, err) {
|
||||
if (error) {
|
||||
var e = handleError('getMeSynchronous', xhr, status, err);
|
||||
var e = handleError('getMe', xhr, status, err);
|
||||
error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ module.exports = {
|
||||
|
||||
RECIEVED_MSG: null,
|
||||
|
||||
CLICK_TEAM: null,
|
||||
RECIEVED_TEAM: null,
|
||||
|
||||
RECIEVED_CONFIG: null,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{define "footer"}}
|
||||
<div class="footer-pane col-xs-12">
|
||||
<div class="col-xs-12">
|
||||
<span class="pull-right footer-site-name">{{ .ClientProps.SiteName }}</span>
|
||||
<span class="pull-right footer-site-name">{{ .ClientCfg.SiteName }}</span>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<span class="pull-right footer-link copyright">© 2015 Mattermost, Inc.</span>
|
||||
|
||||
@@ -19,7 +19,10 @@
|
||||
<!-- Android add to homescreen -->
|
||||
|
||||
<script>
|
||||
window.config = {{ .ClientProps }};
|
||||
window.mm_config = {{ .ClientCfg }};
|
||||
window.mm_team = {{ .Team }};
|
||||
window.mm_user = {{ .User }};
|
||||
window.mm_session = {{ .Session }};
|
||||
</script>
|
||||
|
||||
<!-- CSS Should always go first -->
|
||||
@@ -70,9 +73,9 @@
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
if (window.config.SegmentDeveloperKey != null && window.config.SegmentDeveloperKey !== "") {
|
||||
if (window.mm_config.SegmentDeveloperKey != null && window.mm_config.SegmentDeveloperKey !== "") {
|
||||
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.0.1";
|
||||
analytics.load(window.config.SegmentDeveloperKey);
|
||||
analytics.load(window.mm_config.SegmentDeveloperKey);
|
||||
var user = window.UserStore.getCurrentUser(true);
|
||||
if (user) {
|
||||
analytics.identify(user.id, {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="col-sm-12">
|
||||
<div class="signup-team__container">
|
||||
<img class="signup-team-logo" src="/static/images/logo.png" />
|
||||
<h1>{{ .ClientProps.SiteName }}</h1>
|
||||
<h1>{{ .ClientCfg.SiteName }}</h1>
|
||||
<h4 class="color--light">All team communication in one place, searchable and accessible anywhere</h4>
|
||||
<div id="signup-team"></div>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="row main">
|
||||
<div class="app__content">
|
||||
<div class="welcome-info">
|
||||
<h1>Welcome to {{ .ClientProps.SiteName }}!</h1>
|
||||
<h1>Welcome to {{ .ClientCfg.SiteName }}!</h1>
|
||||
<p>
|
||||
You do not appear to be part of any teams. Please contact your
|
||||
administrator to have him send you an invitation to a private team.
|
||||
|
||||
84
web/web.go
84
web/web.go
@@ -32,10 +32,22 @@ func NewHtmlTemplatePage(templateName string, title string) *HtmlTemplatePage {
|
||||
|
||||
props := make(map[string]string)
|
||||
props["Title"] = title
|
||||
return &HtmlTemplatePage{TemplateName: templateName, Props: props, ClientProps: utils.ClientProperties}
|
||||
return &HtmlTemplatePage{TemplateName: templateName, Props: props, ClientCfg: utils.ClientCfg}
|
||||
}
|
||||
|
||||
func (me *HtmlTemplatePage) Render(c *api.Context, w http.ResponseWriter) {
|
||||
//if me.Team != nil {
|
||||
//me.Team.Sanitize()
|
||||
//}
|
||||
|
||||
if me.User != nil {
|
||||
me.User.Sanitize(map[string]bool{})
|
||||
}
|
||||
|
||||
if me.Session != nil {
|
||||
me.Session.Sanitize()
|
||||
}
|
||||
|
||||
if err := Templates.ExecuteTemplate(w, me.TemplateName, me); err != nil {
|
||||
c.SetUnknownError(me.TemplateName, err.Error())
|
||||
}
|
||||
@@ -139,6 +151,40 @@ func CheckBrowserCompatability(c *api.Context, r *http.Request) bool {
|
||||
|
||||
}
|
||||
|
||||
// func getTeamAndUserStart(c *api.Context) (store.StoreChannel, store.StoreChannel) {
|
||||
// teamChan := api.Srv.Store.Team().Get(c.Session.TeamId)
|
||||
// userChan := api.Srv.Store.User().Get(c.Session.UserId)
|
||||
// return teamChan, userChan
|
||||
// }
|
||||
|
||||
// func getTeamAndUserWait(c *api.Context, team store.StoreChannel, user store.StoreChannel) (*model.Team, *model.User) {
|
||||
// if tr := <-team; tr.Err != nil {
|
||||
// c.Err = tr.Err
|
||||
// return nil, nil
|
||||
// } else {
|
||||
// if ur := <-user; ur.Err != nil {
|
||||
// c.Err = ur.Err
|
||||
// return nil, nil
|
||||
// } else {
|
||||
// return tr.Data.(*model.Team), ur.Data.(*model.User)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
func getTeamAndUser(c *api.Context) (*model.Team, *model.User) {
|
||||
if tr := <-api.Srv.Store.Team().Get(c.Session.TeamId); tr.Err != nil {
|
||||
c.Err = tr.Err
|
||||
return nil, nil
|
||||
} else {
|
||||
if ur := <-api.Srv.Store.User().Get(c.Session.UserId); ur.Err != nil {
|
||||
c.Err = ur.Err
|
||||
return nil, nil
|
||||
} else {
|
||||
return tr.Data.(*model.Team), ur.Data.(*model.User)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func root(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if !CheckBrowserCompatability(c, r) {
|
||||
@@ -149,7 +195,15 @@ func root(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
page := NewHtmlTemplatePage("signup_team", "Signup")
|
||||
page.Render(c, w)
|
||||
} else {
|
||||
team, user := getTeamAndUser(c)
|
||||
if c.Err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("home", "Home")
|
||||
page.Team = team
|
||||
page.User = user
|
||||
page.Session = &c.Session
|
||||
page.Props["TeamURL"] = c.GetTeamURL()
|
||||
page.Render(c, w)
|
||||
}
|
||||
@@ -321,8 +375,10 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
name := params["channelname"]
|
||||
teamName := params["team"]
|
||||
|
||||
var team *model.Team
|
||||
teamChan := api.Srv.Store.Team().Get(c.Session.TeamId)
|
||||
team, user := getTeamAndUser(c)
|
||||
if c.Err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var channelId string
|
||||
if result := <-api.Srv.Store.Channel().CheckPermissionsToByName(c.Session.TeamId, name, c.Session.UserId); result.Err != nil {
|
||||
@@ -332,13 +388,6 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
channelId = result.Data.(string)
|
||||
}
|
||||
|
||||
if tResult := <-teamChan; tResult.Err != nil {
|
||||
c.Err = tResult.Err
|
||||
return
|
||||
} else {
|
||||
team = tResult.Data.(*model.Team)
|
||||
}
|
||||
|
||||
if team.Name != teamName {
|
||||
l4g.Error("It appears you are logged into " + team.Name + ", but are trying to access " + teamName)
|
||||
http.Redirect(w, r, c.GetSiteURL()+"/"+team.Name+"/channels/town-square", http.StatusFound)
|
||||
@@ -392,7 +441,7 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("channel", "")
|
||||
page.Props["Title"] = name + " - " + team.DisplayName + " " + page.ClientProps["SiteName"]
|
||||
page.Props["Title"] = name + " - " + team.DisplayName + " " + page.ClientCfg["SiteName"]
|
||||
page.Props["TeamDisplayName"] = team.DisplayName
|
||||
page.Props["TeamName"] = team.Name
|
||||
page.Props["TeamType"] = team.Type
|
||||
@@ -400,6 +449,9 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
page.Props["ChannelName"] = name
|
||||
page.Props["ChannelId"] = channelId
|
||||
page.Props["UserId"] = c.Session.UserId
|
||||
page.Team = team
|
||||
page.User = user
|
||||
page.Session = &c.Session
|
||||
page.Render(c, w)
|
||||
}
|
||||
|
||||
@@ -498,7 +550,7 @@ func resetPassword(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("password_reset", "")
|
||||
page.Props["Title"] = "Reset Password " + page.ClientProps["SiteName"]
|
||||
page.Props["Title"] = "Reset Password " + page.ClientCfg["SiteName"]
|
||||
page.Props["TeamDisplayName"] = teamDisplayName
|
||||
page.Props["TeamName"] = teamName
|
||||
page.Props["Hash"] = hash
|
||||
@@ -699,7 +751,15 @@ func adminConsole(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
team, user := getTeamAndUser(c)
|
||||
if c.Err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
page := NewHtmlTemplatePage("admin_console", "Admin Console")
|
||||
page.User = user
|
||||
page.Team = team
|
||||
page.Session = &c.Session
|
||||
page.Render(c, w)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user