Merge pull request #687 from mattermost/PLT-93

PLT-93 Cleaning up client side configs
Этот коммит содержится в:
Christopher Speller
2015-09-16 12:52:50 -04:00
родитель 9828d84f01 4e3896d7b1
Коммит 7e418714bc
87 изменённых файлов: 431 добавлений и 708 удалений

Просмотреть файл

@@ -20,6 +20,7 @@ func InitAdmin(r *mux.Router) {
sr := r.PathPrefix("/admin").Subrouter() sr := r.PathPrefix("/admin").Subrouter()
sr.Handle("/logs", ApiUserRequired(getLogs)).Methods("GET") sr.Handle("/logs", ApiUserRequired(getLogs)).Methods("GET")
sr.Handle("/client_props", ApiAppHandler(getClientProperties)).Methods("GET")
} }
func getLogs(c *Context, w http.ResponseWriter, r *http.Request) { func getLogs(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -49,3 +50,7 @@ func getLogs(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write([]byte(model.ArrayToJson(lines))) w.Write([]byte(model.ArrayToJson(lines)))
} }
func getClientProperties(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write([]byte(model.MapToJson(utils.ClientProperties)))
}

Просмотреть файл

@@ -33,3 +33,12 @@ func TestGetLogs(t *testing.T) {
t.Fatal() t.Fatal()
} }
} }
func TestGetClientProperties(t *testing.T) {
Setup()
if _, err := Client.GetClientProperties(); err != nil {
t.Fatal(err)
}
}

Просмотреть файл

@@ -16,10 +16,12 @@ var ServerTemplates *template.Template
type ServerTemplatePage Page type ServerTemplatePage Page
func NewServerTemplatePage(templateName, siteURL string) *ServerTemplatePage { func NewServerTemplatePage(templateName string) *ServerTemplatePage {
props := make(map[string]string) return &ServerTemplatePage{
props["AnalyticsUrl"] = utils.Cfg.ServiceSettings.AnalyticsUrl TemplateName: templateName,
return &ServerTemplatePage{TemplateName: templateName, SiteName: utils.Cfg.ServiceSettings.SiteName, FeedbackEmail: utils.Cfg.EmailSettings.FeedbackEmail, SiteURL: siteURL, Props: props} Props: make(map[string]string),
ClientProps: utils.ClientProperties,
}
} }
func (me *ServerTemplatePage) Render() string { func (me *ServerTemplatePage) Render() string {
@@ -40,7 +42,6 @@ func InitApi() {
InitWebSocket(r) InitWebSocket(r)
InitFile(r) InitFile(r)
InitCommand(r) InitCommand(r)
InitConfig(r)
InitAdmin(r) InitAdmin(r)
templatesDir := utils.FindDir("api/templates") templatesDir := utils.FindDir("api/templates")

Просмотреть файл

@@ -1,34 +0,0 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
package api
import (
l4g "code.google.com/p/log4go"
"encoding/json"
"github.com/gorilla/mux"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
"net/http"
"strconv"
)
func InitConfig(r *mux.Router) {
l4g.Debug("Initializing config api routes")
sr := r.PathPrefix("/config").Subrouter()
sr.Handle("/get_all", ApiAppHandler(getConfig)).Methods("GET")
}
func getConfig(c *Context, w http.ResponseWriter, r *http.Request) {
settings := make(map[string]string)
settings["ByPassEmail"] = strconv.FormatBool(utils.Cfg.EmailSettings.ByPassEmail)
if bytes, err := json.Marshal(settings); err != nil {
c.Err = model.NewAppError("getConfig", "Unable to marshall configuration data", err.Error())
return
} else {
w.Write(bytes)
}
}

Просмотреть файл

@@ -4,6 +4,7 @@
package api package api
import ( import (
"fmt"
"net" "net"
"net/http" "net/http"
"net/url" "net/url"
@@ -29,12 +30,9 @@ type Context struct {
} }
type Page struct { type Page struct {
TemplateName string TemplateName string
Title string Props map[string]string
SiteName string ClientProps map[string]string
FeedbackEmail string
SiteURL string
Props map[string]string
} }
func ApiAppHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler { func ApiAppHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler {
@@ -100,7 +98,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
c.setSiteURL(protocol + "://" + r.Host) c.setSiteURL(protocol + "://" + r.Host)
w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId) w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId)
w.Header().Set(model.HEADER_VERSION_ID, utils.Cfg.ServiceSettings.Version) w.Header().Set(model.HEADER_VERSION_ID, utils.Cfg.ServiceSettings.Version+fmt.Sprintf(".%v", utils.CfgLastModified))
// Instruct the browser not to display us in an iframe for anti-clickjacking // Instruct the browser not to display us in an iframe for anti-clickjacking
if !h.isApi { if !h.isApi {

Просмотреть файл

@@ -378,7 +378,8 @@ func fireAndForgetNotifications(post *model.Post, teamId, siteURL string) {
location, _ := time.LoadLocation("UTC") location, _ := time.LoadLocation("UTC")
tm := time.Unix(post.CreateAt/1000, 0).In(location) tm := time.Unix(post.CreateAt/1000, 0).In(location)
subjectPage := NewServerTemplatePage("post_subject", siteURL) subjectPage := NewServerTemplatePage("post_subject")
subjectPage.Props["SiteURL"] = siteURL
subjectPage.Props["TeamDisplayName"] = teamDisplayName subjectPage.Props["TeamDisplayName"] = teamDisplayName
subjectPage.Props["SubjectText"] = subjectText subjectPage.Props["SubjectText"] = subjectText
subjectPage.Props["Month"] = tm.Month().String()[:3] subjectPage.Props["Month"] = tm.Month().String()[:3]
@@ -396,7 +397,8 @@ func fireAndForgetNotifications(post *model.Post, teamId, siteURL string) {
continue continue
} }
bodyPage := NewServerTemplatePage("post_body", siteURL) bodyPage := NewServerTemplatePage("post_body")
bodyPage.Props["SiteURL"] = siteURL
bodyPage.Props["Nickname"] = profileMap[id].FirstName bodyPage.Props["Nickname"] = profileMap[id].FirstName
bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage.Props["ChannelName"] = channelName bodyPage.Props["ChannelName"] = channelName

Просмотреть файл

@@ -56,8 +56,10 @@ func signupTeam(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
subjectPage := NewServerTemplatePage("signup_team_subject", c.GetSiteURL()) subjectPage := NewServerTemplatePage("signup_team_subject")
bodyPage := NewServerTemplatePage("signup_team_body", c.GetSiteURL()) subjectPage.Props["SiteURL"] = c.GetSiteURL()
bodyPage := NewServerTemplatePage("signup_team_body")
bodyPage.Props["SiteURL"] = c.GetSiteURL()
bodyPage.Props["TourUrl"] = utils.Cfg.TeamSettings.TourLink bodyPage.Props["TourUrl"] = utils.Cfg.TeamSettings.TourLink
props := make(map[string]string) props := make(map[string]string)
@@ -401,8 +403,10 @@ func emailTeams(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
subjectPage := NewServerTemplatePage("find_teams_subject", c.GetSiteURL()) subjectPage := NewServerTemplatePage("find_teams_subject")
bodyPage := NewServerTemplatePage("find_teams_body", c.GetSiteURL()) subjectPage.Props["SiteURL"] = c.GetSiteURL()
bodyPage := NewServerTemplatePage("find_teams_body")
bodyPage.Props["SiteURL"] = c.GetSiteURL()
if result := <-Srv.Store.Team().GetTeamsForEmail(email); result.Err != nil { if result := <-Srv.Store.Team().GetTeamsForEmail(email); result.Err != nil {
c.Err = result.Err c.Err = result.Err
@@ -483,16 +487,17 @@ func InviteMembers(c *Context, team *model.Team, user *model.User, invites []str
senderRole = "member" senderRole = "member"
} }
subjectPage := NewServerTemplatePage("invite_subject", c.GetSiteURL()) subjectPage := NewServerTemplatePage("invite_subject")
subjectPage.Props["SiteURL"] = c.GetSiteURL()
subjectPage.Props["SenderName"] = sender subjectPage.Props["SenderName"] = sender
subjectPage.Props["TeamDisplayName"] = team.DisplayName subjectPage.Props["TeamDisplayName"] = team.DisplayName
bodyPage := NewServerTemplatePage("invite_body", c.GetSiteURL())
bodyPage := NewServerTemplatePage("invite_body")
bodyPage.Props["SiteURL"] = c.GetSiteURL()
bodyPage.Props["TeamDisplayName"] = team.DisplayName bodyPage.Props["TeamDisplayName"] = team.DisplayName
bodyPage.Props["SenderName"] = sender bodyPage.Props["SenderName"] = sender
bodyPage.Props["SenderStatus"] = senderRole bodyPage.Props["SenderStatus"] = senderRole
bodyPage.Props["Email"] = invite bodyPage.Props["Email"] = invite
props := make(map[string]string) props := make(map[string]string)
props["email"] = invite props["email"] = invite
props["id"] = team.Id props["id"] = team.Id

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -25,7 +25,7 @@
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -34,7 +34,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>{{ .SiteName }} - Error</title> <title>{{ .ClientProps.SiteName }} - Error</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
@@ -12,9 +12,9 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="error__container"> <div class="error__container">
<div class="error__icon"><i class="fa fa-exclamation-triangle"></i></div> <div class="error__icon"><i class="fa fa-exclamation-triangle"></i></div>
<h2>{{ .SiteName }} needs your help:</h2> <h2>{{ .ClientProps.SiteName }} needs your help:</h2>
<p>{{.Message}}</p> <p>{{.Message}}</p>
<a href="{{.SiteURL}}">Go back to team site</a> <a href="{{.Props.SiteURL}}">Go back to team site</a>
</div> </div>
</div> </div>
</body> </body>

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -33,7 +33,7 @@
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -42,7 +42,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -1 +1 @@
{{define "find_teams_subject"}}Your {{ .SiteName }} Teams{{end}} {{define "find_teams_subject"}}Your {{ .ClientProps.SiteName }} Teams{{end}}

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -18,7 +18,7 @@
<tr> <tr>
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;"> <td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
<h2 style="font-weight: normal; margin-top: 10px;">You've been invited</h2> <h2 style="font-weight: normal; margin-top: 10px;">You've been invited</h2>
<p>{{.Props.TeamDisplayName}} started using {{.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 {{.ClientProps.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 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> <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> </p>
@@ -28,7 +28,7 @@
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -37,7 +37,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -1 +1 @@
{{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.SiteName}}{{end}} {{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.ClientProps.SiteName}}{{end}}

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -25,7 +25,7 @@
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -34,7 +34,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -1 +1 @@
{{define "password_change_subject"}}You updated your password for {{.Props.TeamDisplayName}} on {{ .SiteName }}{{end}} {{define "password_change_subject"}}You updated your password for {{.Props.TeamDisplayName}} on {{ .ClientProps.SiteName }}{{end}}

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -28,7 +28,7 @@
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -37,7 +37,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -1 +1 @@
{{define "post_subject"}}[{{.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}} {{define "post_subject"}}[{{.ClientProps.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}}

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -28,7 +28,7 @@
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -37,7 +37,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -21,7 +21,7 @@
<p style="margin: 20px 0 25px"> <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> <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> </p>
{{ .SiteName }} is one place for all your team communication, searchable and available anywhere.<br>You'll get more out of {{ .SiteName }} when your team is in constant communication--let's get them on board.<br></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>
<p> <p>
Learn more by <a href="{{.Props.TourUrl}}" style="text-decoration: none; color:#2389D7;">taking a tour</a> Learn more by <a href="{{.Props.TourUrl}}" style="text-decoration: none; color:#2389D7;">taking a tour</a>
</p> </p>
@@ -31,7 +31,7 @@
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -40,7 +40,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -1 +1 @@
{{define "signup_team_subject"}}Invitation to {{ .SiteName }}{{end}} {{define "signup_team_subject"}}Invitation to {{ .ClientProps.SiteName }}{{end}}

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -28,7 +28,7 @@
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -37,7 +37,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -1 +1 @@
{{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .SiteName }}] Email Verification{{end}} {{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .ClientProps.SiteName }}] Email Verification{{end}}

Просмотреть файл

@@ -9,7 +9,7 @@
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;">
<tr> <tr>
<td style="padding: 20px 20px 10px; text-align:left;"> <td style="padding: 20px 20px 10px; text-align:left;">
<img src="{{.SiteURL}}/static/images/{{.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt=""> <img src="{{.Props.SiteURL}}/static/images/{{.ClientProps.SiteName}}-logodark.png" width="130px" style="opacity: 0.5" alt="">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -17,15 +17,15 @@
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto"> <table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
<tr> <tr>
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;"> <td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
<h2 style="font-weight: normal; margin-top: 10px;">You joined the {{.Props.TeamDisplayName}} team at {{.SiteName}}!</h2> <h2 style="font-weight: normal; margin-top: 10px;">You joined the {{.Props.TeamDisplayName}} team at {{.ClientProps.SiteName}}!</h2>
<p>Please let me know if you have any questions.<br>Enjoy your stay at <a href="{{.Props.TeamURL}}">{{.SiteName}}</a>.</p> <p>Please let me know if you have any questions.<br>Enjoy your stay at <a href="{{.Props.TeamURL}}">{{.ClientProps.SiteName}}</a>.</p>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;"> <td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br> Any questions at all, mail us any time: <a href="mailto:{{.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.FeedbackEmail}}</a>.<br>
Best wishes,<br> Best wishes,<br>
The {{.SiteName}} Team<br> The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>
@@ -34,7 +34,7 @@
<tr> <tr>
<td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;"> <td style="text-align: center;color: #AAA; font-size: 11px; padding-bottom: 10px;">
<p style="margin: 25px 0;"> <p style="margin: 25px 0;">
<img width="65" src="{{.SiteURL}}/static/images/circles.png" alt=""> <img width="65" src="{{.Props.SiteURL}}/static/images/circles.png" alt="">
</p> </p>
<p style="padding: 0 50px;"> <p style="padding: 0 50px;">
(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br> (c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>

Просмотреть файл

@@ -1 +1 @@
{{define "welcome_subject"}}Welcome to {{ .SiteName }}{{end}} {{define "welcome_subject"}}Welcome to {{ .ClientProps.SiteName }}{{end}}

Просмотреть файл

@@ -216,8 +216,10 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User {
func fireAndForgetWelcomeEmail(name, email, teamDisplayName, link, siteURL string) { func fireAndForgetWelcomeEmail(name, email, teamDisplayName, link, siteURL string) {
go func() { go func() {
subjectPage := NewServerTemplatePage("welcome_subject", siteURL) subjectPage := NewServerTemplatePage("welcome_subject")
bodyPage := NewServerTemplatePage("welcome_body", siteURL) subjectPage.Props["SiteURL"] = siteURL
bodyPage := NewServerTemplatePage("welcome_body")
bodyPage.Props["SiteURL"] = siteURL
bodyPage.Props["Nickname"] = name bodyPage.Props["Nickname"] = name
bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage.Props["FeedbackName"] = utils.Cfg.EmailSettings.FeedbackName bodyPage.Props["FeedbackName"] = utils.Cfg.EmailSettings.FeedbackName
@@ -235,9 +237,11 @@ func FireAndForgetVerifyEmail(userId, userEmail, teamName, teamDisplayName, site
link := fmt.Sprintf("%s/verify_email?uid=%s&hid=%s&teamname=%s&email=%s", siteURL, userId, model.HashPassword(userId), teamName, userEmail) link := fmt.Sprintf("%s/verify_email?uid=%s&hid=%s&teamname=%s&email=%s", siteURL, userId, model.HashPassword(userId), teamName, userEmail)
subjectPage := NewServerTemplatePage("verify_subject", siteURL) subjectPage := NewServerTemplatePage("verify_subject")
subjectPage.Props["SiteURL"] = siteURL
subjectPage.Props["TeamDisplayName"] = teamDisplayName subjectPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage := NewServerTemplatePage("verify_body", siteURL) bodyPage := NewServerTemplatePage("verify_body")
bodyPage.Props["SiteURL"] = siteURL
bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage.Props["VerifyUrl"] = link bodyPage.Props["VerifyUrl"] = link
@@ -1133,8 +1137,10 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) {
link := fmt.Sprintf("%s/reset_password?d=%s&h=%s", c.GetTeamURLFromTeam(team), url.QueryEscape(data), url.QueryEscape(hash)) link := fmt.Sprintf("%s/reset_password?d=%s&h=%s", c.GetTeamURLFromTeam(team), url.QueryEscape(data), url.QueryEscape(hash))
subjectPage := NewServerTemplatePage("reset_subject", c.GetSiteURL()) subjectPage := NewServerTemplatePage("reset_subject")
bodyPage := NewServerTemplatePage("reset_body", c.GetSiteURL()) subjectPage.Props["SiteURL"] = c.GetSiteURL()
bodyPage := NewServerTemplatePage("reset_body")
bodyPage.Props["SiteURL"] = c.GetSiteURL()
bodyPage.Props["ResetUrl"] = link bodyPage.Props["ResetUrl"] = link
if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil { if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
@@ -1233,9 +1239,11 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) {
func fireAndForgetPasswordChangeEmail(email, teamDisplayName, teamURL, siteURL, method string) { func fireAndForgetPasswordChangeEmail(email, teamDisplayName, teamURL, siteURL, method string) {
go func() { go func() {
subjectPage := NewServerTemplatePage("password_change_subject", siteURL) subjectPage := NewServerTemplatePage("password_change_subject")
subjectPage.Props["SiteURL"] = siteURL
subjectPage.Props["TeamDisplayName"] = teamDisplayName subjectPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage := NewServerTemplatePage("password_change_body", siteURL) bodyPage := NewServerTemplatePage("password_change_body")
bodyPage.Props["SiteURL"] = siteURL
bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage.Props["TeamURL"] = teamURL bodyPage.Props["TeamURL"] = teamURL
bodyPage.Props["Method"] = method bodyPage.Props["Method"] = method
@@ -1250,9 +1258,11 @@ func fireAndForgetPasswordChangeEmail(email, teamDisplayName, teamURL, siteURL,
func fireAndForgetEmailChangeEmail(email, teamDisplayName, teamURL, siteURL string) { func fireAndForgetEmailChangeEmail(email, teamDisplayName, teamURL, siteURL string) {
go func() { go func() {
subjectPage := NewServerTemplatePage("email_change_subject", siteURL) subjectPage := NewServerTemplatePage("email_change_subject")
subjectPage.Props["SiteURL"] = siteURL
subjectPage.Props["TeamDisplayName"] = teamDisplayName subjectPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage := NewServerTemplatePage("email_change_body", siteURL) bodyPage := NewServerTemplatePage("email_change_body")
bodyPage.Props["SiteURL"] = siteURL
bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage.Props["TeamURL"] = teamURL bodyPage.Props["TeamURL"] = teamURL

Просмотреть файл

@@ -86,16 +86,14 @@
"ShowSkypeId": true, "ShowSkypeId": true,
"ShowFullName": true "ShowFullName": true
}, },
"ClientSettings": {
"SegmentDeveloperKey": "",
"GoogleDeveloperKey": ""
},
"TeamSettings": { "TeamSettings": {
"MaxUsersPerTeam": 150, "MaxUsersPerTeam": 150,
"AllowPublicLink": true, "AllowPublicLink": true,
"AllowValetDefault": false, "AllowValetDefault": false,
"TermsLink": "/static/help/configure_links.html",
"PrivacyLink": "/static/help/configure_links.html",
"AboutLink": "/static/help/configure_links.html",
"HelpLink": "/static/help/configure_links.html",
"ReportProblemLink": "/static/help/configure_links.html",
"TourLink": "/static/help/configure_links.html",
"DefaultThemeColor": "#2389D7", "DefaultThemeColor": "#2389D7",
"DisableTeamCreation": false, "DisableTeamCreation": false,
"RestrictCreationToDomains": "" "RestrictCreationToDomains": ""

Просмотреть файл

@@ -347,6 +347,15 @@ func (c *Client) GetLogs() (*Result, *AppError) {
} }
} }
func (c *Client) GetClientProperties() (*Result, *AppError) {
if r, err := c.DoGet("/admin/client_props", "", ""); err != nil {
return nil, err
} else {
return &Result{r.Header.Get(HEADER_REQUEST_ID),
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
}
}
func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) { func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) {
if r, err := c.DoPost("/channels/create", channel.ToJson()); err != nil { if r, err := c.DoPost("/channels/create", channel.ToJson()); err != nil {
return nil, err return nil, err

Просмотреть файл

@@ -4,10 +4,13 @@
package utils package utils
import ( import (
l4g "code.google.com/p/log4go"
"encoding/json" "encoding/json"
"fmt"
"os" "os"
"path/filepath" "path/filepath"
"strconv"
l4g "code.google.com/p/log4go"
) )
const ( const (
@@ -109,15 +112,15 @@ type PrivacySettings struct {
ShowFullName bool ShowFullName bool
} }
type ClientSettings struct {
SegmentDeveloperKey string
GoogleDeveloperKey string
}
type TeamSettings struct { type TeamSettings struct {
MaxUsersPerTeam int MaxUsersPerTeam int
AllowPublicLink bool AllowPublicLink bool
AllowValetDefault bool AllowValetDefault bool
TermsLink string
PrivacyLink string
AboutLink string
HelpLink string
ReportProblemLink string
TourLink string TourLink string
DefaultThemeColor string DefaultThemeColor string
DisableTeamCreation bool DisableTeamCreation bool
@@ -133,6 +136,7 @@ type Config struct {
EmailSettings EmailSettings EmailSettings EmailSettings
RateLimitSettings RateLimitSettings RateLimitSettings RateLimitSettings
PrivacySettings PrivacySettings PrivacySettings PrivacySettings
ClientSettings ClientSettings
TeamSettings TeamSettings TeamSettings TeamSettings
SSOSettings map[string]SSOSetting SSOSettings map[string]SSOSetting
} }
@@ -147,6 +151,8 @@ func (o *Config) ToJson() string {
} }
var Cfg *Config = &Config{} var Cfg *Config = &Config{}
var CfgLastModified int64 = 0
var ClientProperties map[string]string = map[string]string{}
var SanitizeOptions map[string]bool = map[string]bool{} var SanitizeOptions map[string]bool = map[string]bool{}
func FindConfigFile(fileName string) string { func FindConfigFile(fileName string) string {
@@ -242,22 +248,48 @@ func LoadConfig(fileName string) {
panic("Error decoding config file=" + fileName + ", err=" + err.Error()) panic("Error decoding config file=" + fileName + ", err=" + err.Error())
} }
if info, err := file.Stat(); err != nil {
panic("Error getting config info file=" + fileName + ", err=" + err.Error())
} else {
CfgLastModified = info.ModTime().Unix()
}
configureLog(&config.LogSettings) configureLog(&config.LogSettings)
Cfg = &config Cfg = &config
SanitizeOptions = getSanitizeOptions() SanitizeOptions = getSanitizeOptions(Cfg)
ClientProperties = getClientProperties(Cfg)
} }
func getSanitizeOptions() map[string]bool { func getSanitizeOptions(c *Config) map[string]bool {
options := map[string]bool{} options := map[string]bool{}
options["fullname"] = Cfg.PrivacySettings.ShowFullName options["fullname"] = c.PrivacySettings.ShowFullName
options["email"] = Cfg.PrivacySettings.ShowEmailAddress options["email"] = c.PrivacySettings.ShowEmailAddress
options["skypeid"] = Cfg.PrivacySettings.ShowSkypeId options["skypeid"] = c.PrivacySettings.ShowSkypeId
options["phonenumber"] = Cfg.PrivacySettings.ShowPhoneNumber options["phonenumber"] = c.PrivacySettings.ShowPhoneNumber
return options return options
} }
func getClientProperties(c *Config) map[string]string {
props := make(map[string]string)
props["Version"] = c.ServiceSettings.Version
props["SiteName"] = c.ServiceSettings.SiteName
props["ByPassEmail"] = strconv.FormatBool(c.EmailSettings.ByPassEmail)
props["ShowEmailAddress"] = strconv.FormatBool(c.PrivacySettings.ShowEmailAddress)
props["AllowPublicLink"] = strconv.FormatBool(c.TeamSettings.AllowPublicLink)
props["SegmentDeveloperKey"] = c.ClientSettings.SegmentDeveloperKey
props["GoogleDeveloperKey"] = c.ClientSettings.GoogleDeveloperKey
props["AnalyticsUrl"] = c.ServiceSettings.AnalyticsUrl
props["ByPassEmail"] = strconv.FormatBool(c.EmailSettings.ByPassEmail)
props["ProfileHeight"] = fmt.Sprintf("%v", c.ImageSettings.ProfileHeight)
props["ProfileWidth"] = fmt.Sprintf("%v", c.ImageSettings.ProfileWidth)
props["ProfileWidth"] = fmt.Sprintf("%v", c.ImageSettings.ProfileWidth)
return props
}
func IsS3Configured() bool { func IsS3Configured() bool {
if Cfg.AWSSettings.S3AccessKeyId == "" || Cfg.AWSSettings.S3SecretAccessKey == "" || Cfg.AWSSettings.S3Region == "" || Cfg.AWSSettings.S3Bucket == "" { if Cfg.AWSSettings.S3AccessKeyId == "" || Cfg.AWSSettings.S3SecretAccessKey == "" || Cfg.AWSSettings.S3Region == "" || Cfg.AWSSettings.S3Bucket == "" {
return false return false

Просмотреть файл

@@ -1,8 +1,6 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information. // See License.txt for license information.
import {config} from '../utils/config.js';
export default class EmailVerify extends React.Component { export default class EmailVerify extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@@ -19,10 +17,10 @@ export default class EmailVerify extends React.Component {
var body = ''; var body = '';
var resend = ''; var resend = '';
if (this.props.isVerified === 'true') { if (this.props.isVerified === 'true') {
title = config.SiteName + ' Email Verified'; title = global.window.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>; body = <p>Your email has been verified! Click <a href={this.props.teamURL + '?email=' + this.props.userEmail}>here</a> to log in.</p>;
} else { } else {
title = config.SiteName + ' Email Not Verified'; title = global.window.config.SiteName + ' Email Not Verified';
body = <p>Please verify your email address. Check your inbox for an email.</p>; body = <p>Please verify your email address. Check your inbox for an email.</p>;
resend = ( resend = (
<button <button

Просмотреть файл

@@ -3,7 +3,6 @@
var utils = require('../utils/utils.jsx'); var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx'); var client = require('../utils/client.jsx');
import {strings} from '../utils/config.js';
export default class FindTeam extends React.Component { export default class FindTeam extends React.Component {
constructor(props) { constructor(props) {
@@ -51,8 +50,8 @@ export default class FindTeam extends React.Component {
if (this.state.sent) { if (this.state.sent) {
return ( return (
<div> <div>
<h4>{'Find Your ' + utils.toTitleCase(strings.Team)}</h4> <h4>{'Find Your team'}</h4>
<p>{'An email was sent with links to any ' + strings.TeamPlural + ' to which you are a member.'}</p> <p>{'An email was sent with links to any teams to which you are a member.'}</p>
</div> </div>
); );
} }
@@ -61,7 +60,7 @@ export default class FindTeam extends React.Component {
<div> <div>
<h4>Find Your Team</h4> <h4>Find Your Team</h4>
<form onSubmit={this.handleSubmit}> <form onSubmit={this.handleSubmit}>
<p>{'Get an email with links to any ' + strings.TeamPlural + ' to which you are a member.'}</p> <p>{'Get an email with links to any teams to which you are a member.'}</p>
<div className='form-group'> <div className='form-group'>
<label className='control-label'>Email</label> <label className='control-label'>Email</label>
<div className={emailErrorClass}> <div className={emailErrorClass}>

Просмотреть файл

@@ -2,7 +2,6 @@
// See License.txt for license information. // See License.txt for license information.
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
import {strings} from '../utils/config.js';
export default class GetLinkModal extends React.Component { export default class GetLinkModal extends React.Component {
constructor(props) { constructor(props) {
@@ -76,9 +75,9 @@ export default class GetLinkModal extends React.Component {
</div> </div>
<div className='modal-body'> <div className='modal-body'>
<p> <p>
Send {strings.Team + 'mates'} the link below for them to sign-up to this {strings.Team} site. Send teammates the link below for them to sign-up to this team site.
<br /><br /> <br /><br />
Be careful not to share this link publicly, since anyone with the link can join your {strings.Team}. Be careful not to share this link publicly, since anyone with the link can join your team.
</p> </p>
<textarea <textarea
className='form-control no-resize' className='form-control no-resize'

Просмотреть файл

@@ -2,11 +2,9 @@
// See License.txt for license information. // See License.txt for license information.
var utils = require('../utils/utils.jsx'); var utils = require('../utils/utils.jsx');
var ConfigStore = require('../stores/config_store.jsx');
var Client = require('../utils/client.jsx'); var Client = require('../utils/client.jsx');
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
var ConfirmModal = require('./confirm_modal.jsx'); var ConfirmModal = require('./confirm_modal.jsx');
import {config} from '../utils/config.js';
export default class InviteMemberModal extends React.Component { export default class InviteMemberModal extends React.Component {
constructor(props) { constructor(props) {
@@ -23,7 +21,7 @@ export default class InviteMemberModal extends React.Component {
emailErrors: {}, emailErrors: {},
firstNameErrors: {}, firstNameErrors: {},
lastNameErrors: {}, lastNameErrors: {},
emailEnabled: !ConfigStore.getSettingAsBoolean('ByPassEmail', false) emailEnabled: !global.window.config.ByPassEmail
}; };
} }
@@ -79,23 +77,9 @@ export default class InviteMemberModal extends React.Component {
emailErrors[index] = ''; emailErrors[index] = '';
} }
if (config.AllowInviteNames) { invite.firstName = React.findDOMNode(this.refs['first_name' + index]).value.trim();
invite.firstName = React.findDOMNode(this.refs['first_name' + index]).value.trim();
if (!invite.firstName && config.RequireInviteNames) {
firstNameErrors[index] = 'This is a required field';
valid = false;
} else {
firstNameErrors[index] = '';
}
invite.lastName = React.findDOMNode(this.refs['last_name' + index]).value.trim(); invite.lastName = React.findDOMNode(this.refs['last_name' + index]).value.trim();
if (!invite.lastName && config.RequireInviteNames) {
lastNameErrors[index] = 'This is a required field';
valid = false;
} else {
lastNameErrors[index] = '';
}
}
invites.push(invite); invites.push(invite);
} }
@@ -143,10 +127,8 @@ export default class InviteMemberModal extends React.Component {
for (var i = 0; i < inviteIds.length; i++) { for (var i = 0; i < inviteIds.length; i++) {
var index = inviteIds[i]; var index = inviteIds[i];
React.findDOMNode(this.refs['email' + index]).value = ''; React.findDOMNode(this.refs['email' + index]).value = '';
if (config.AllowInviteNames) { React.findDOMNode(this.refs['first_name' + index]).value = '';
React.findDOMNode(this.refs['first_name' + index]).value = ''; React.findDOMNode(this.refs['last_name' + index]).value = '';
React.findDOMNode(this.refs['last_name' + index]).value = '';
}
} }
this.setState({ this.setState({
@@ -210,44 +192,43 @@ export default class InviteMemberModal extends React.Component {
} }
var nameFields = null; var nameFields = null;
if (config.AllowInviteNames) {
var firstNameClass = 'form-group'; var firstNameClass = 'form-group';
if (firstNameError) { if (firstNameError) {
firstNameClass += ' has-error'; firstNameClass += ' has-error';
}
var lastNameClass = 'form-group';
if (lastNameError) {
lastNameClass += ' has-error';
}
nameFields = (<div className='row--invite'>
<div className='col-sm-6'>
<div className={firstNameClass}>
<input
type='text'
className='form-control'
ref={'first_name' + index}
placeholder='First name'
maxLength='64'
disabled={!this.state.emailEnabled}
/>
{firstNameError}
</div>
</div>
<div className='col-sm-6'>
<div className={lastNameClass}>
<input
type='text'
className='form-control'
ref={'last_name' + index}
placeholder='Last name'
maxLength='64'
disabled={!this.state.emailEnabled}
/>
{lastNameError}
</div>
</div>
</div>);
} }
var lastNameClass = 'form-group';
if (lastNameError) {
lastNameClass += ' has-error';
}
nameFields = (<div className='row--invite'>
<div className='col-sm-6'>
<div className={firstNameClass}>
<input
type='text'
className='form-control'
ref={'first_name' + index}
placeholder='First name'
maxLength='64'
disabled={!this.state.emailEnabled}
/>
{firstNameError}
</div>
</div>
<div className='col-sm-6'>
<div className={lastNameClass}>
<input
type='text'
className='form-control'
ref={'last_name' + index}
placeholder='Last name'
maxLength='64'
disabled={!this.state.emailEnabled}
/>
{lastNameError}
</div>
</div>
</div>);
inviteSections[index] = ( inviteSections[index] = (
<div key={'key' + index}> <div key={'key' + index}>

Просмотреть файл

@@ -6,7 +6,6 @@ const Client = require('../utils/client.jsx');
const UserStore = require('../stores/user_store.jsx'); const UserStore = require('../stores/user_store.jsx');
const BrowserStore = require('../stores/browser_store.jsx'); const BrowserStore = require('../stores/browser_store.jsx');
const Constants = require('../utils/constants.jsx'); const Constants = require('../utils/constants.jsx');
import {config, strings} from '../utils/config.js';
export default class Login extends React.Component { export default class Login extends React.Component {
constructor(props) { constructor(props) {
@@ -177,7 +176,7 @@ export default class Login extends React.Component {
<div className='signup-team__container'> <div className='signup-team__container'>
<h5 className='margin--less'>Sign in to:</h5> <h5 className='margin--less'>Sign in to:</h5>
<h2 className='signup-team__name'>{teamDisplayName}</h2> <h2 className='signup-team__name'>{teamDisplayName}</h2>
<h2 className='signup-team__subdomain'>on {config.SiteName}</h2> <h2 className='signup-team__subdomain'>on {global.window.config.SiteName}</h2>
<form onSubmit={this.handleSubmit}> <form onSubmit={this.handleSubmit}>
<div className={'form-group' + errorClass}> <div className={'form-group' + errorClass}>
{serverError} {serverError}
@@ -185,11 +184,11 @@ export default class Login extends React.Component {
{loginMessage} {loginMessage}
{emailSignup} {emailSignup}
<div className='form-group margin--extra form-group--small'> <div className='form-group margin--extra form-group--small'>
<span><a href='/find_team'>{'Find other ' + strings.TeamPlural}</a></span> <span><a href='/find_team'>{'Find other teams'}</a></span>
</div> </div>
{forgotPassword} {forgotPassword}
<div className='margin--extra'> <div className='margin--extra'>
<span>{'Want to create your own ' + strings.Team + '? '} <span>{'Want to create your own team? '}
<a <a
href='/' href='/'
className='signup-team-login' className='signup-team-login'

Просмотреть файл

@@ -7,7 +7,6 @@ var UserStore = require('../stores/user_store.jsx');
var TeamStore = require('../stores/team_store.jsx'); var TeamStore = require('../stores/team_store.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
import {config} from '../utils/config.js';
function getStateFromStores() { function getStateFromStores() {
return {teams: UserStore.getTeams(), currentTeam: TeamStore.getCurrent()}; return {teams: UserStore.getTeams(), currentTeam: TeamStore.getCurrent()};
@@ -188,7 +187,7 @@ export default class NavbarDropdown extends React.Component {
<li> <li>
<a <a
target='_blank' target='_blank'
href={config.HelpLink} href='/static/help/help.html'
> >
Help Help
</a> </a>
@@ -196,7 +195,7 @@ export default class NavbarDropdown extends React.Component {
<li> <li>
<a <a
target='_blank' target='_blank'
href={config.ReportProblemLink} href='/static/help/report_problem.html'
> >
Report a Problem Report a Problem
</a> </a>

Просмотреть файл

@@ -2,7 +2,6 @@
// See License.txt for license information. // See License.txt for license information.
var client = require('../utils/client.jsx'); var client = require('../utils/client.jsx');
import {config} from '../utils/config.js';
export default class PasswordResetForm extends React.Component { export default class PasswordResetForm extends React.Component {
constructor(props) { constructor(props) {
@@ -62,7 +61,7 @@ export default class PasswordResetForm extends React.Component {
<div className='signup-team__container'> <div className='signup-team__container'>
<h3>Password Reset</h3> <h3>Password Reset</h3>
<form onSubmit={this.handlePasswordReset}> <form onSubmit={this.handlePasswordReset}>
<p>{'Enter a new password for your ' + this.props.teamDisplayName + ' ' + config.SiteName + ' account.'}</p> <p>{'Enter a new password for your ' + this.props.teamDisplayName + ' ' + global.window.config.SiteName + ' account.'}</p>
<div className={formClass}> <div className={formClass}>
<input <input
type='password' type='password'

Просмотреть файл

@@ -15,8 +15,6 @@ var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes; var ActionTypes = Constants.ActionTypes;
import {strings} from '../utils/config.js';
export default class PostList extends React.Component { export default class PostList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@@ -347,7 +345,7 @@ export default class PostList extends React.Component {
return ( return (
<div className='channel-intro'> <div className='channel-intro'>
<p className='channel-intro-text'>{'This is the start of your private message history with this ' + strings.Team + 'mate. Private messages and files shared here are not shown to people outside this area.'}</p> <p className='channel-intro-text'>{'This is the start of your private message history with this teammate. Private messages and files shared here are not shown to people outside this area.'}</p>
</div> </div>
); );
} }
@@ -369,7 +367,7 @@ export default class PostList extends React.Component {
<p className='channel-intro__content'> <p className='channel-intro__content'>
Welcome to {channel.display_name}! Welcome to {channel.display_name}!
<br/><br/> <br/><br/>
This is the first channel {strings.Team}mates see when they This is the first channel teammates see when they
<br/> <br/>
sign up - use it for posting updates everyone needs to know. sign up - use it for posting updates everyone needs to know.
<br/><br/> <br/><br/>

Просмотреть файл

@@ -1,8 +1,6 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information. // See License.txt for license information.
import {config} from '../utils/config.js';
export default class SettingPicture extends React.Component { export default class SettingPicture extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@@ -81,7 +79,7 @@ export default class SettingPicture extends React.Component {
>Save</a> >Save</a>
); );
} }
var helpText = 'Upload a profile picture in either JPG or PNG format, at least ' + config.ProfileWidth + 'px in width and ' + config.ProfileHeight + 'px height.'; 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 self = this; var self = this;
return ( return (

Просмотреть файл

@@ -3,7 +3,6 @@
var NavbarDropdown = require('./navbar_dropdown.jsx'); var NavbarDropdown = require('./navbar_dropdown.jsx');
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
import {config} from '../utils/config.js';
export default class SidebarHeader extends React.Component { export default class SidebarHeader extends React.Component {
constructor(props) { constructor(props) {
@@ -59,7 +58,7 @@ export default class SidebarHeader extends React.Component {
} }
SidebarHeader.defaultProps = { SidebarHeader.defaultProps = {
teamDisplayName: config.SiteName, teamDisplayName: global.window.config.SiteName,
teamType: '' teamType: ''
}; };
SidebarHeader.propTypes = { SidebarHeader.propTypes = {

Просмотреть файл

@@ -4,7 +4,6 @@
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
var client = require('../utils/client.jsx'); var client = require('../utils/client.jsx');
var utils = require('../utils/utils.jsx'); var utils = require('../utils/utils.jsx');
import {config} from '../utils/config.js';
export default class SidebarRightMenu extends React.Component { export default class SidebarRightMenu extends React.Component {
constructor(props) { constructor(props) {
@@ -75,8 +74,8 @@ export default class SidebarRightMenu extends React.Component {
} }
var siteName = ''; var siteName = '';
if (config.SiteName != null) { if (global.window.config.SiteName != null) {
siteName = config.SiteName; siteName = global.window.config.SiteName;
} }
var teamDisplayName = siteName; var teamDisplayName = siteName;
if (this.props.teamDisplayName) { if (this.props.teamDisplayName) {

Просмотреть файл

@@ -4,7 +4,6 @@
var WelcomePage = require('./team_signup_welcome_page.jsx'); var WelcomePage = require('./team_signup_welcome_page.jsx');
var TeamDisplayNamePage = require('./team_signup_display_name_page.jsx'); var TeamDisplayNamePage = require('./team_signup_display_name_page.jsx');
var TeamURLPage = require('./team_signup_url_page.jsx'); var TeamURLPage = require('./team_signup_url_page.jsx');
var AllowedDomainsPage = require('./team_signup_allowed_domains_page.jsx');
var SendInivtesPage = require('./team_signup_send_invites_page.jsx'); var SendInivtesPage = require('./team_signup_send_invites_page.jsx');
var UsernamePage = require('./team_signup_username_page.jsx'); var UsernamePage = require('./team_signup_username_page.jsx');
var PasswordPage = require('./team_signup_password_page.jsx'); var PasswordPage = require('./team_signup_password_page.jsx');
@@ -70,15 +69,6 @@ export default class SignupTeamComplete extends React.Component {
); );
} }
if (this.state.wizard === 'allowed_domains') {
return (
<AllowedDomainsPage
state={this.state}
updateParent={this.updateParent}
/>
);
}
if (this.state.wizard === 'send_invites') { if (this.state.wizard === 'send_invites') {
return ( return (
<SendInivtesPage <SendInivtesPage

Просмотреть файл

@@ -6,7 +6,6 @@ var client = require('../utils/client.jsx');
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
var BrowserStore = require('../stores/browser_store.jsx'); var BrowserStore = require('../stores/browser_store.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
import {config} from '../utils/config.js';
export default class SignupUserComplete extends React.Component { export default class SignupUserComplete extends React.Component {
constructor(props) { constructor(props) {
@@ -136,7 +135,7 @@ export default class SignupUserComplete extends React.Component {
// set up the email entry and hide it if an email was provided // set up the email entry and hide it if an email was provided
var yourEmailIs = ''; var yourEmailIs = '';
if (this.state.user.email) { if (this.state.user.email) {
yourEmailIs = <span>Your email address is {this.state.user.email}. You'll use this address to sign in to {config.SiteName}.</span>; yourEmailIs = <span>Your email address is {this.state.user.email}. You'll use this address to sign in to {global.window.config.SiteName}.</span>;
} }
var emailContainerStyle = 'margin--extra'; var emailContainerStyle = 'margin--extra';
@@ -237,11 +236,6 @@ export default class SignupUserComplete extends React.Component {
); );
} }
var termsDisclaimer = null;
if (config.ShowTermsDuringSignup) {
termsDisclaimer = <p>By creating an account and using Mattermost you are agreeing to our <a href={config.TermsLink}>Terms of Service</a>. If you do not agree, you cannot use this service.</p>;
}
return ( return (
<div> <div>
<form> <form>
@@ -251,12 +245,11 @@ export default class SignupUserComplete extends React.Component {
/> />
<h5 className='margin--less'>Welcome to:</h5> <h5 className='margin--less'>Welcome to:</h5>
<h2 className='signup-team__name'>{this.props.teamDisplayName}</h2> <h2 className='signup-team__name'>{this.props.teamDisplayName}</h2>
<h2 className='signup-team__subdomain'>on {config.SiteName}</h2> <h2 className='signup-team__subdomain'>on {global.window.config.SiteName}</h2>
<h4 className='color--light'>Let's create your account</h4> <h4 className='color--light'>Let's create your account</h4>
{signupMessage} {signupMessage}
{emailSignup} {emailSignup}
{serverError} {serverError}
{termsDisclaimer}
</form> </form>
</div> </div>
); );

Просмотреть файл

@@ -6,7 +6,6 @@ const SettingItemMax = require('./setting_item_max.jsx');
const Client = require('../utils/client.jsx'); const Client = require('../utils/client.jsx');
const Utils = require('../utils/utils.jsx'); const Utils = require('../utils/utils.jsx');
import {strings} from '../utils/config.js';
export default class GeneralTab extends React.Component { export default class GeneralTab extends React.Component {
constructor(props) { constructor(props) {
@@ -30,7 +29,7 @@ export default class GeneralTab extends React.Component {
state.clientError = 'This field is required'; state.clientError = 'This field is required';
valid = false; valid = false;
} else if (name === this.props.teamDisplayName) { } else if (name === this.props.teamDisplayName) {
state.clientError = 'Please choose a new name for your ' + strings.Team; state.clientError = 'Please choose a new name for your team';
valid = false; valid = false;
} else { } else {
state.clientError = ''; state.clientError = '';
@@ -99,7 +98,7 @@ export default class GeneralTab extends React.Component {
if (this.props.activeSection === 'name') { if (this.props.activeSection === 'name') {
let inputs = []; let inputs = [];
let teamNameLabel = Utils.toTitleCase(strings.Team) + ' Name'; let teamNameLabel = 'Team Name';
if (Utils.isMobile()) { if (Utils.isMobile()) {
teamNameLabel = ''; teamNameLabel = '';
} }
@@ -123,7 +122,7 @@ export default class GeneralTab extends React.Component {
nameSection = ( nameSection = (
<SettingItemMax <SettingItemMax
title={`${Utils.toTitleCase(strings.Team)} Name`} title={`Team Name`}
inputs={inputs} inputs={inputs}
submit={this.handleNameSubmit} submit={this.handleNameSubmit}
server_error={serverError} server_error={serverError}
@@ -136,7 +135,7 @@ export default class GeneralTab extends React.Component {
nameSection = ( nameSection = (
<SettingItemMin <SettingItemMin
title={`${Utils.toTitleCase(strings.Team)} Name`} title={`Team Name`}
describe={describe} describe={describe}
updateSection={this.onUpdateSection} updateSection={this.onUpdateSection}
/> />

Просмотреть файл

@@ -1,143 +0,0 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
var Client = require('../utils/client.jsx');
import {strings} from '../utils/config.js';
export default class TeamSignupAllowedDomainsPage extends React.Component {
constructor(props) {
super(props);
this.submitBack = this.submitBack.bind(this);
this.submitNext = this.submitNext.bind(this);
this.state = {};
}
submitBack(e) {
e.preventDefault();
this.props.state.wizard = 'team_url';
this.props.updateParent(this.props.state);
}
submitNext(e) {
e.preventDefault();
if (React.findDOMNode(this.refs.open_network).checked) {
this.props.state.wizard = 'send_invites';
this.props.state.team.type = 'O';
this.props.updateParent(this.props.state);
return;
}
if (React.findDOMNode(this.refs.allow).checked) {
var name = React.findDOMNode(this.refs.name).value.trim();
var domainRegex = /^\w+\.\w+$/;
if (!name) {
this.setState({nameError: 'This field is required'});
return;
}
if (!name.trim().match(domainRegex)) {
this.setState({nameError: 'The domain doesn\'t appear valid'});
return;
}
this.props.state.wizard = 'send_invites';
this.props.state.team.allowed_domains = name;
this.props.state.team.type = 'I';
this.props.updateParent(this.props.state);
} else {
this.props.state.wizard = 'send_invites';
this.props.state.team.type = 'I';
this.props.updateParent(this.props.state);
}
}
render() {
Client.track('signup', 'signup_team_04_allow_domains');
var nameError = null;
var nameDivClass = 'form-group';
if (this.state.nameError) {
nameError = <label className='control-label'>{this.state.nameError}</label>;
nameDivClass += ' has-error';
}
return (
<div>
<form>
<img
className='signup-team-logo'
src='/static/images/logo.png'
/>
<h2>Email Domain</h2>
<p>
<div className='checkbox'>
<label>
<input
type='checkbox'
ref='allow'
defaultChecked={true}
/>
{' Allow sign up and ' + strings.Team + ' discovery with a ' + strings.Company + ' email address.'}
</label>
</div>
</p>
<p>{'Check this box to allow your ' + strings.Team + ' members to sign up using their ' + strings.Company + ' email addresses if you share the same domain--otherwise, you need to invite everyone yourself.'}</p>
<h4>{'Your ' + strings.Team + '\'s domain for emails'}</h4>
<div className={nameDivClass}>
<div className='row'>
<div className='col-sm-9'>
<div className='input-group'>
<span className='input-group-addon'>@</span>
<input
type='text'
ref='name'
className='form-control'
placeholder=''
maxLength='128'
defaultValue={this.props.state.team.allowed_domains}
autoFocus={true}
onFocus={this.handleFocus}
/>
</div>
</div>
</div>
{nameError}
</div>
<p>To allow signups from multiple domains, separate each with a comma.</p>
<p>
<div className='checkbox'>
<label>
<input
type='checkbox'
ref='open_network'
defaultChecked={this.props.state.team.type === 'O'}
/> Allow anyone to signup to this domain without an invitation.</label>
</div>
</p>
<button
type='button'
className='btn btn-default'
onClick={this.submitBack}
>
<i className='glyphicon glyphicon-chevron-left'></i> Back
</button>&nbsp;
<button
type='submit'
className='btn-primary btn'
onClick={this.submitNext}
>
Next<i className='glyphicon glyphicon-chevron-right'></i>
</button>
</form>
</div>
);
}
}
TeamSignupAllowedDomainsPage.defaultProps = {
state: {}
};
TeamSignupAllowedDomainsPage.propTypes = {
state: React.PropTypes.object,
updateParent: React.PropTypes.func
};

Просмотреть файл

@@ -2,7 +2,6 @@
// See License.txt for license information. // See License.txt for license information.
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
import {strings} from '../utils/config.js';
export default class ChooseAuthPage extends React.Component { export default class ChooseAuthPage extends React.Component {
constructor(props) { constructor(props) {
@@ -24,7 +23,7 @@ export default class ChooseAuthPage extends React.Component {
} }
> >
<span className='icon' /> <span className='icon' />
<span>Create new {strings.Team} with GitLab Account</span> <span>Create new team with GitLab Account</span>
</a> </a>
); );
} }
@@ -42,7 +41,7 @@ export default class ChooseAuthPage extends React.Component {
} }
> >
<span className='fa fa-envelope' /> <span className='fa fa-envelope' />
<span>Create new {strings.Team} with email address</span> <span>Create new team with email address</span>
</a> </a>
); );
} }
@@ -55,7 +54,7 @@ export default class ChooseAuthPage extends React.Component {
<div> <div>
{buttons} {buttons}
<div className='form-group margin--extra-2x'> <div className='form-group margin--extra-2x'>
<span><a href='/find_team'>{'Find my ' + strings.Team}</a></span> <span><a href='/find_team'>{'Find my team'}</a></span>
</div> </div>
</div> </div>
); );

Просмотреть файл

@@ -3,7 +3,6 @@
var utils = require('../utils/utils.jsx'); var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx'); var client = require('../utils/client.jsx');
import {strings} from '../utils/config.js';
export default class TeamSignupDisplayNamePage extends React.Component { export default class TeamSignupDisplayNamePage extends React.Component {
constructor(props) { constructor(props) {
@@ -54,7 +53,7 @@ export default class TeamSignupDisplayNamePage extends React.Component {
className='signup-team-logo' className='signup-team-logo'
src='/static/images/logo.png' src='/static/images/logo.png'
/> />
<h2>{utils.toTitleCase(strings.Team) + ' Name'}</h2> <h2>{'Team Name'}</h2>
<div className={nameDivClass}> <div className={nameDivClass}>
<div className='row'> <div className='row'>
<div className='col-sm-9'> <div className='col-sm-9'>
@@ -73,7 +72,7 @@ export default class TeamSignupDisplayNamePage extends React.Component {
{nameError} {nameError}
</div> </div>
<div> <div>
{'Name your ' + strings.Team + ' in any language. Your ' + strings.Team + ' name shows in menus and headings.'} {'Name your team in any language. Your team name shows in menus and headings.'}
</div> </div>
<button <button
type='submit' type='submit'

Просмотреть файл

@@ -4,7 +4,6 @@
var Client = require('../utils/client.jsx'); var Client = require('../utils/client.jsx');
var BrowserStore = require('../stores/browser_store.jsx'); var BrowserStore = require('../stores/browser_store.jsx');
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
import {strings, config} from '../utils/config.js';
export default class TeamSignupPasswordPage extends React.Component { export default class TeamSignupPasswordPage extends React.Component {
constructor(props) { constructor(props) {
@@ -123,13 +122,13 @@ export default class TeamSignupPasswordPage extends React.Component {
type='submit' type='submit'
className='btn btn-primary margin--extra' className='btn btn-primary margin--extra'
id='finish-button' id='finish-button'
data-loading-text={'<span class=\'glyphicon glyphicon-refresh glyphicon-refresh-animate\'></span> Creating ' + strings.Team + '...'} data-loading-text={'<span class=\'glyphicon glyphicon-refresh glyphicon-refresh-animate\'></span> Creating team...'}
onClick={this.submitNext} onClick={this.submitNext}
> >
Finish Finish
</button> </button>
</div> </div>
<p>By proceeding to create your account and use {config.SiteName}, you agree to our <a href={config.TermsLink}>Terms of Service</a> and <a href={config.PrivacyLink}>Privacy Policy</a>. If you do not agree, you cannot use {config.SiteName}.</p> <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>
<div className='margin--extra'> <div className='margin--extra'>
<a <a
href='#' href='#'

Просмотреть файл

@@ -2,10 +2,7 @@
// See License.txt for license information. // See License.txt for license information.
var EmailItem = require('./team_signup_email_item.jsx'); var EmailItem = require('./team_signup_email_item.jsx');
var Utils = require('../utils/utils.jsx');
var ConfigStore = require('../stores/config_store.jsx');
var Client = require('../utils/client.jsx'); var Client = require('../utils/client.jsx');
import {strings, config} from '../utils/config.js';
export default class TeamSignupSendInvitesPage extends React.Component { export default class TeamSignupSendInvitesPage extends React.Component {
constructor(props) { constructor(props) {
@@ -16,7 +13,7 @@ export default class TeamSignupSendInvitesPage extends React.Component {
this.submitSkip = this.submitSkip.bind(this); this.submitSkip = this.submitSkip.bind(this);
this.keySubmit = this.keySubmit.bind(this); this.keySubmit = this.keySubmit.bind(this);
this.state = { this.state = {
emailEnabled: !ConfigStore.getSettingAsBoolean('ByPassEmail', false) emailEnabled: !global.window.config.ByPassEmail
}; };
if (!this.state.emailEnabled) { if (!this.state.emailEnabled) {
@@ -26,12 +23,7 @@ export default class TeamSignupSendInvitesPage extends React.Component {
} }
submitBack(e) { submitBack(e) {
e.preventDefault(); e.preventDefault();
this.props.state.wizard = 'team_url';
if (config.AllowSignupDomainsWizard) {
this.props.state.wizard = 'allowed_domains';
} else {
this.props.state.wizard = 'team_url';
}
this.props.updateParent(this.props.state); this.props.updateParent(this.props.state);
} }
@@ -138,7 +130,7 @@ export default class TeamSignupSendInvitesPage extends React.Component {
bottomContent = ( bottomContent = (
<p className='color--light'> <p className='color--light'>
{'if you prefer, you can invite ' + strings.Team + ' members later'} {'if you prefer, you can invite team members later'}
<br /> <br />
{' and '} {' and '}
<a <a
@@ -153,7 +145,7 @@ export default class TeamSignupSendInvitesPage extends React.Component {
} else { } else {
content = ( content = (
<div className='form-group color--light'> <div className='form-group color--light'>
{'Email is currently disabled for your ' + strings.Team + ', and emails cannot be sent. Contact your system administrator to enable email and email invitations.'} {'Email is currently disabled for your team, and emails cannot be sent. Contact your system administrator to enable email and email invitations.'}
</div> </div>
); );
} }
@@ -165,7 +157,7 @@ export default class TeamSignupSendInvitesPage extends React.Component {
className='signup-team-logo' className='signup-team-logo'
src='/static/images/logo.png' src='/static/images/logo.png'
/> />
<h2>{'Invite ' + Utils.toTitleCase(strings.Team) + ' Members'}</h2> <h2>{'Invite Team Members'}</h2>
{content} {content}
<div className='form-group'> <div className='form-group'>
<button <button

Просмотреть файл

@@ -4,7 +4,6 @@
const Utils = require('../utils/utils.jsx'); const Utils = require('../utils/utils.jsx');
const Client = require('../utils/client.jsx'); const Client = require('../utils/client.jsx');
const Constants = require('../utils/constants.jsx'); const Constants = require('../utils/constants.jsx');
import {strings, config} from '../utils/config.js';
export default class TeamSignupUrlPage extends React.Component { export default class TeamSignupUrlPage extends React.Component {
constructor(props) { constructor(props) {
@@ -51,12 +50,8 @@ export default class TeamSignupUrlPage extends React.Component {
Client.findTeamByName(name, Client.findTeamByName(name,
function success(data) { function success(data) {
if (!data) { if (!data) {
if (config.AllowSignupDomainsWizard) { this.props.state.wizard = 'send_invites';
this.props.state.wizard = 'allowed_domains'; this.props.state.team.type = 'O';
} else {
this.props.state.wizard = 'send_invites';
this.props.state.team.type = 'O';
}
this.props.state.team.name = name; this.props.state.team.name = name;
this.props.updateParent(this.props.state); this.props.updateParent(this.props.state);
@@ -97,7 +92,7 @@ export default class TeamSignupUrlPage extends React.Component {
className='signup-team-logo' className='signup-team-logo'
src='/static/images/logo.png' src='/static/images/logo.png'
/> />
<h2>{`${Utils.toTitleCase(strings.Team)} URL`}</h2> <h2>{`Team URL`}</h2>
<div className={nameDivClass}> <div className={nameDivClass}>
<div className='row'> <div className='row'>
<div className='col-sm-11'> <div className='col-sm-11'>
@@ -124,7 +119,7 @@ export default class TeamSignupUrlPage extends React.Component {
</div> </div>
{nameError} {nameError}
</div> </div>
<p>{`Choose the web address of your new ${strings.Team}:`}</p> <p>{`Choose the web address of your new team:`}</p>
<ul className='color--light'> <ul className='color--light'>
<li>Short and memorable is best</li> <li>Short and memorable is best</li>
<li>Use lowercase letters, numbers and dashes</li> <li>Use lowercase letters, numbers and dashes</li>

Просмотреть файл

@@ -3,7 +3,6 @@
var Utils = require('../utils/utils.jsx'); var Utils = require('../utils/utils.jsx');
var Client = require('../utils/client.jsx'); var Client = require('../utils/client.jsx');
import {strings} from '../utils/config.js';
export default class TeamSignupUsernamePage extends React.Component { export default class TeamSignupUsernamePage extends React.Component {
constructor(props) { constructor(props) {
@@ -55,7 +54,7 @@ export default class TeamSignupUsernamePage extends React.Component {
src='/static/images/logo.png' src='/static/images/logo.png'
/> />
<h2 className='margin--less'>Your username</h2> <h2 className='margin--less'>Your username</h2>
<h5 className='color--light'>{'Select a memorable username that makes it easy for ' + strings.Team + 'mates to identify you:'}</h5> <h5 className='color--light'>{'Select a memorable username that makes it easy for teammates to identify you:'}</h5>
<div className='inner__content margin--extra'> <div className='inner__content margin--extra'>
<div className={nameDivClass}> <div className={nameDivClass}>
<div className='row'> <div className='row'>

Просмотреть файл

@@ -4,7 +4,6 @@
var Utils = require('../utils/utils.jsx'); var Utils = require('../utils/utils.jsx');
var Client = require('../utils/client.jsx'); var Client = require('../utils/client.jsx');
var BrowserStore = require('../stores/browser_store.jsx'); var BrowserStore = require('../stores/browser_store.jsx');
import {config} from '../utils/config.js';
export default class TeamSignupWelcomePage extends React.Component { export default class TeamSignupWelcomePage extends React.Component {
constructor(props) { constructor(props) {
@@ -112,7 +111,7 @@ export default class TeamSignupWelcomePage extends React.Component {
src='/static/images/logo.png' src='/static/images/logo.png'
/> />
<h3 className='sub-heading'>Welcome to:</h3> <h3 className='sub-heading'>Welcome to:</h3>
<h1 className='margin--top-none'>{config.SiteName}</h1> <h1 className='margin--top-none'>{global.window.config.SiteName}</h1>
</p> </p>
<p className='margin--less'>Let's set up your new team</p> <p className='margin--less'>Let's set up your new team</p>
<p> <p>

Просмотреть файл

@@ -3,7 +3,6 @@
const Utils = require('../utils/utils.jsx'); const Utils = require('../utils/utils.jsx');
const Client = require('../utils/client.jsx'); const Client = require('../utils/client.jsx');
import {strings} from '../utils/config.js';
export default class EmailSignUpPage extends React.Component { export default class EmailSignUpPage extends React.Component {
constructor() { constructor() {
@@ -70,7 +69,7 @@ export default class EmailSignUpPage extends React.Component {
</button> </button>
</div> </div>
<div className='form-group margin--extra-2x'> <div className='form-group margin--extra-2x'>
<span><a href='/find_team'>{`Find my ${strings.Team}`}</a></span> <span><a href='/find_team'>{`Find my team`}</a></span>
</div> </div>
</form> </form>
); );

Просмотреть файл

@@ -4,7 +4,6 @@
var utils = require('../utils/utils.jsx'); var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx'); var client = require('../utils/client.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
import {strings} from '../utils/config.js';
export default class SSOSignUpPage extends React.Component { export default class SSOSignUpPage extends React.Component {
constructor(props) { constructor(props) {
@@ -84,7 +83,7 @@ export default class SSOSignUpPage extends React.Component {
disabled={disabled} disabled={disabled}
> >
<span className='icon'/> <span className='icon'/>
<span>Create {strings.Team} with GitLab Account</span> <span>Create team with GitLab Account</span>
</a> </a>
); );
} }
@@ -111,7 +110,7 @@ export default class SSOSignUpPage extends React.Component {
{serverError} {serverError}
</div> </div>
<div className='form-group margin--extra-2x'> <div className='form-group margin--extra-2x'>
<span><a href='/find_team'>{'Find my ' + strings.Team}</a></span> <span><a href='/find_team'>{'Find my team'}</a></span>
</div> </div>
</form> </form>
); );

Просмотреть файл

@@ -3,7 +3,6 @@
var Utils = require('../utils/utils.jsx'); var Utils = require('../utils/utils.jsx');
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
import {config} from '../utils/config.js';
var id = 0; var id = 0;
@@ -58,7 +57,7 @@ export default class UserProfile extends React.Component {
} }
var dataContent = '<img class="user-popover__image" src="/api/v1/users/' + this.state.profile.id + '/image?time=' + this.state.profile.update_at + '" height="128" width="128" />'; var dataContent = '<img class="user-popover__image" src="/api/v1/users/' + this.state.profile.id + '/image?time=' + this.state.profile.update_at + '" height="128" width="128" />';
if (!config.ShowEmail) { if (!global.window.config.ShowEmailAddress) {
dataContent += '<div class="text-nowrap">Email not shared</div>'; dataContent += '<div class="text-nowrap">Email not shared</div>';
} else { } else {
dataContent += '<div data-toggle="tooltip" title="' + this.state.profile.email + '"><a href="mailto:' + this.state.profile.email + '" class="text-nowrap text-lowercase user-popover__email">' + this.state.profile.email + '</a></div>'; dataContent += '<div data-toggle="tooltip" title="' + this.state.profile.email + '"><a href="mailto:' + this.state.profile.email + '" class="text-nowrap text-lowercase user-popover__email">' + this.state.profile.email + '</a></div>';

Просмотреть файл

@@ -6,7 +6,8 @@ var SettingItemMin = require('./setting_item_min.jsx');
var SettingItemMax = require('./setting_item_max.jsx'); var SettingItemMax = require('./setting_item_max.jsx');
var Client = require('../utils/client.jsx'); var Client = require('../utils/client.jsx');
var Utils = require('../utils/utils.jsx'); var Utils = require('../utils/utils.jsx');
import {config} from '../utils/config.js';
var ThemeColors = ['#2389d7', '#008a17', '#dc4fad', '#ac193d', '#0072c6', '#d24726', '#ff8f32', '#82ba00', '#03b3b2', '#008299', '#4617b4', '#8c0095', '#004b8b', '#004b8b', '#570000', '#380000', '#585858', '#000000'];
export default class UserSettingsAppearance extends React.Component { export default class UserSettingsAppearance extends React.Component {
constructor(props) { constructor(props) {
@@ -21,8 +22,8 @@ export default class UserSettingsAppearance extends React.Component {
getStateFromStores() { getStateFromStores() {
var user = UserStore.getCurrentUser(); var user = UserStore.getCurrentUser();
var theme = '#2389d7'; var theme = '#2389d7';
if (config.ThemeColors != null) { if (ThemeColors != null) {
theme = config.ThemeColors[0]; theme = ThemeColors[0];
} }
if (user.props && user.props.theme) { if (user.props && user.props.theme) {
theme = user.props.theme; theme = user.props.theme;
@@ -83,18 +84,18 @@ export default class UserSettingsAppearance extends React.Component {
var themeSection; var themeSection;
var self = this; var self = this;
if (config.ThemeColors != null) { if (ThemeColors != null) {
if (this.props.activeSection === 'theme') { if (this.props.activeSection === 'theme') {
var themeButtons = []; var themeButtons = [];
for (var i = 0; i < config.ThemeColors.length; i++) { for (var i = 0; i < ThemeColors.length; i++) {
themeButtons.push( themeButtons.push(
<button <button
key={config.ThemeColors[i] + 'key' + i} key={ThemeColors[i] + 'key' + i}
ref={config.ThemeColors[i]} ref={ThemeColors[i]}
type='button' type='button'
className='btn btn-lg color-btn' className='btn btn-lg color-btn'
style={{backgroundColor: config.ThemeColors[i]}} style={{backgroundColor: ThemeColors[i]}}
onClick={this.updateTheme} onClick={this.updateTheme}
/> />
); );

Просмотреть файл

@@ -2,7 +2,6 @@
// See License.txt for license information. // See License.txt for license information.
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
var ConfigStore = require('../stores/config_store.jsx');
var SettingItemMin = require('./setting_item_min.jsx'); var SettingItemMin = require('./setting_item_min.jsx');
var SettingItemMax = require('./setting_item_max.jsx'); var SettingItemMax = require('./setting_item_max.jsx');
var SettingPicture = require('./setting_picture.jsx'); var SettingPicture = require('./setting_picture.jsx');
@@ -209,7 +208,7 @@ export default class UserSettingsGeneralTab extends React.Component {
} }
setupInitialState(props) { setupInitialState(props) {
var user = props.user; var user = props.user;
var emailEnabled = !ConfigStore.getSettingAsBoolean('ByPassEmail', false); var emailEnabled = !global.window.config.ByPassEmail;
return {username: user.username, firstName: user.first_name, lastName: user.last_name, nickname: user.nickname, return {username: user.username, firstName: user.first_name, lastName: user.last_name, nickname: user.nickname,
email: user.email, picture: null, loadingPicture: false, emailEnabled: emailEnabled}; email: user.email, picture: null, loadingPicture: false, emailEnabled: emailEnabled};
} }

Просмотреть файл

@@ -8,7 +8,6 @@ var client = require('../utils/client.jsx');
var AsyncClient = require('../utils/async_client.jsx'); var AsyncClient = require('../utils/async_client.jsx');
var utils = require('../utils/utils.jsx'); var utils = require('../utils/utils.jsx');
var assign = require('object-assign'); var assign = require('object-assign');
import {config} from '../utils/config.js';
function getNotificationsStateFromStores() { function getNotificationsStateFromStores() {
var user = UserStore.getCurrentUser(); var user = UserStore.getCurrentUser();
@@ -415,7 +414,7 @@ export default class NotificationsTab extends React.Component {
</label> </label>
<br/> <br/>
</div> </div>
<div><br/>{'Email notifications are sent for mentions and private messages after you have been away from ' + config.SiteName + ' for 5 minutes.'}</div> <div><br/>{'Email notifications are sent for mentions and private messages after you have been away from ' + global.window.config.SiteName + ' for 5 minutes.'}</div>
</div> </div>
); );

Просмотреть файл

@@ -3,7 +3,6 @@
var Client = require('../utils/client.jsx'); var Client = require('../utils/client.jsx');
var Utils = require('../utils/utils.jsx'); var Utils = require('../utils/utils.jsx');
import {config} from '../utils/config.js';
export default class ViewImageModal extends React.Component { export default class ViewImageModal extends React.Component {
constructor(props) { constructor(props) {
@@ -301,7 +300,7 @@ export default class ViewImageModal extends React.Component {
} }
var publicLink = ''; var publicLink = '';
if (config.AllowPublicLink) { if (global.window.config.AllowPublicLink) {
publicLink = ( publicLink = (
<div> <div>
<a <a

Просмотреть файл

@@ -34,23 +34,19 @@ var ActivityLogModal = require('../components/activity_log_modal.jsx');
var RemovedFromChannelModal = require('../components/removed_from_channel_modal.jsx'); var RemovedFromChannelModal = require('../components/removed_from_channel_modal.jsx');
var FileUploadOverlay = require('../components/file_upload_overlay.jsx'); var FileUploadOverlay = require('../components/file_upload_overlay.jsx');
var AsyncClient = require('../utils/async_client.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes; var ActionTypes = Constants.ActionTypes;
function setupChannelPage(teamName, teamType, teamId, channelName, channelId) { function setupChannelPage(props) {
AsyncClient.getConfig();
AppDispatcher.handleViewAction({ AppDispatcher.handleViewAction({
type: ActionTypes.CLICK_CHANNEL, type: ActionTypes.CLICK_CHANNEL,
name: channelName, name: props.ChannelName,
id: channelId id: props.ChannelId
}); });
AppDispatcher.handleViewAction({ AppDispatcher.handleViewAction({
type: ActionTypes.CLICK_TEAM, type: ActionTypes.CLICK_TEAM,
id: teamId id: props.TeamId
}); });
// ChannelLoader must be rendered first // ChannelLoader must be rendered first
@@ -65,14 +61,14 @@ function setupChannelPage(teamName, teamType, teamId, channelName, channelId) {
); );
React.render( React.render(
<Navbar teamDisplayName={teamName} />, <Navbar teamDisplayName={props.TeamDisplayName} />,
document.getElementById('navbar') document.getElementById('navbar')
); );
React.render( React.render(
<Sidebar <Sidebar
teamDisplayName={teamName} teamDisplayName={props.TeamDisplayName}
teamType={teamType} teamType={props.TeamType}
/>, />,
document.getElementById('sidebar-left') document.getElementById('sidebar-left')
); );
@@ -88,17 +84,17 @@ function setupChannelPage(teamName, teamType, teamId, channelName, channelId) {
); );
React.render( React.render(
<TeamSettingsModal teamDisplayName={teamName} />, <TeamSettingsModal teamDisplayName={props.TeamDisplayName} />,
document.getElementById('team_settings_modal') document.getElementById('team_settings_modal')
); );
React.render( React.render(
<TeamMembersModal teamDisplayName={teamName} />, <TeamMembersModal teamDisplayName={props.TeamDisplayName} />,
document.getElementById('team_members_modal') document.getElementById('team_members_modal')
); );
React.render( React.render(
<MemberInviteModal teamType={teamType} />, <MemberInviteModal teamType={props.TeamType} />,
document.getElementById('invite_member_modal') document.getElementById('invite_member_modal')
); );
@@ -184,8 +180,8 @@ function setupChannelPage(teamName, teamType, teamId, channelName, channelId) {
React.render( React.render(
<SidebarRightMenu <SidebarRightMenu
teamDisplayName={teamName} teamDisplayName={props.TeamDisplayName}
teamType={teamType} teamType={props.TeamType}
/>, />,
document.getElementById('sidebar-menu') document.getElementById('sidebar-menu')
); );

Просмотреть файл

@@ -4,12 +4,12 @@
var ChannelStore = require('../stores/channel_store.jsx'); var ChannelStore = require('../stores/channel_store.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
function setupHomePage(teamURL) { function setupHomePage(props) {
var last = ChannelStore.getLastVisitedName(); var last = ChannelStore.getLastVisitedName();
if (last == null || last.length === 0) { if (last == null || last.length === 0) {
window.location = teamURL + '/channels/' + Constants.DEFAULT_CHANNEL; window.location = props.TeamURL + '/channels/' + Constants.DEFAULT_CHANNEL;
} else { } else {
window.location = teamURL + '/channels/' + last; window.location = props.TeamURL + '/channels/' + last;
} }
} }

Просмотреть файл

@@ -3,12 +3,12 @@
var Login = require('../components/login.jsx'); var Login = require('../components/login.jsx');
function setupLoginPage(teamDisplayName, teamName, authServices) { function setupLoginPage(props) {
React.render( React.render(
<Login <Login
teamDisplayName={teamDisplayName} teamDisplayName={props.TeamDisplayName}
teamName={teamName} teamName={props.TeamName}
authServices={authServices} authServices={props.AuthServices}
/>, />,
document.getElementById('login') document.getElementById('login')
); );

Просмотреть файл

@@ -3,14 +3,14 @@
var PasswordReset = require('../components/password_reset.jsx'); var PasswordReset = require('../components/password_reset.jsx');
function setupPasswordResetPage(isReset, teamDisplayName, teamName, hash, data) { function setupPasswordResetPage(props) {
React.render( React.render(
<PasswordReset <PasswordReset
isReset={isReset} isReset={props.IsReset}
teamDisplayName={teamDisplayName} teamDisplayName={props.TeamDisplayName}
teamName={teamName} teamName={props.TeamName}
hash={hash} hash={props.Hash}
data={data} data={props.Data}
/>, />,
document.getElementById('reset') document.getElementById('reset')
); );

Просмотреть файл

@@ -3,12 +3,8 @@
var SignupTeam = require('../components/signup_team.jsx'); var SignupTeam = require('../components/signup_team.jsx');
var AsyncClient = require('../utils/async_client.jsx'); function setupSignupTeamPage(props) {
var services = JSON.parse(props.AuthServices);
function setupSignupTeamPage(authServices) {
AsyncClient.getConfig();
var services = JSON.parse(authServices);
React.render( React.render(
<SignupTeam services={services} />, <SignupTeam services={services} />,

Просмотреть файл

@@ -3,12 +3,12 @@
var SignupTeamComplete = require('../components/signup_team_complete.jsx'); var SignupTeamComplete = require('../components/signup_team_complete.jsx');
function setupSignupTeamCompletePage(email, data, hash) { function setupSignupTeamCompletePage(props) {
React.render( React.render(
<SignupTeamComplete <SignupTeamComplete
email={email} email={props.Email}
hash={hash} hash={props.Hash}
data={data} data={props.Data}
/>, />,
document.getElementById('signup-team-complete') document.getElementById('signup-team-complete')
); );

Просмотреть файл

@@ -3,16 +3,16 @@
var SignupUserComplete = require('../components/signup_user_complete.jsx'); var SignupUserComplete = require('../components/signup_user_complete.jsx');
function setupSignupUserCompletePage(email, name, uiName, id, data, hash, authServices) { function setupSignupUserCompletePage(props) {
React.render( React.render(
<SignupUserComplete <SignupUserComplete
teamId={id} teamId={props.TeamId}
teamName={name} teamName={props.TeamName}
teamDisplayName={uiName} teamDisplayName={props.TeamDisplayName}
email={email} email={props.Email}
hash={hash} hash={props.Hash}
data={data} data={props.Data}
authServices={authServices} authServices={props.AuthServices}
/>, />,
document.getElementById('signup-user-complete') document.getElementById('signup-user-complete')
); );

Просмотреть файл

@@ -3,12 +3,12 @@
var EmailVerify = require('../components/email_verify.jsx'); var EmailVerify = require('../components/email_verify.jsx');
global.window.setupVerifyPage = function setupVerifyPage(isVerified, teamURL, userEmail) { global.window.setupVerifyPage = function setupVerifyPage(props) {
React.render( React.render(
<EmailVerify <EmailVerify
isVerified={isVerified} isVerified={props.IsVerified}
teamURL={teamURL} teamURL={props.TeamURL}
userEmail={userEmail} userEmail={props.UserEmail}
/>, />,
document.getElementById('verify') document.getElementById('verify')
); );

Просмотреть файл

@@ -1,69 +0,0 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
var EventEmitter = require('events').EventEmitter;
var BrowserStore = require('../stores/browser_store.jsx');
var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes;
var CHANGE_EVENT = 'change';
class ConfigStoreClass extends EventEmitter {
constructor() {
super();
this.emitChange = this.emitChange.bind(this);
this.addChangeListener = this.addChangeListener.bind(this);
this.removeChangeListener = this.removeChangeListener.bind(this);
this.getSetting = this.getSetting.bind(this);
this.getSettingAsBoolean = this.getSettingAsBoolean.bind(this);
this.updateStoredSettings = this.updateStoredSettings.bind(this);
}
emitChange() {
this.emit(CHANGE_EVENT);
}
addChangeListener(callback) {
this.on(CHANGE_EVENT, callback);
}
removeChangeListener(callback) {
this.removeListener(CHANGE_EVENT, callback);
}
getSetting(key, defaultValue) {
return BrowserStore.getItem('config_' + key, defaultValue);
}
getSettingAsBoolean(key, defaultValue) {
var value = this.getSetting(key, defaultValue);
if (typeof value !== 'string') {
return Boolean(value);
}
return value === 'true';
}
updateStoredSettings(settings) {
for (let key in settings) {
if (settings.hasOwnProperty(key)) {
BrowserStore.setItem('config_' + key, settings[key]);
}
}
}
}
var ConfigStore = new ConfigStoreClass();
ConfigStore.dispatchToken = AppDispatcher.register(function registry(payload) {
var action = payload.action;
switch (action.type) {
case ActionTypes.RECIEVED_CONFIG:
ConfigStore.updateStoredSettings(action.settings);
ConfigStore.emitChange();
break;
default:
}
});
export default ConfigStore;

Просмотреть файл

@@ -582,28 +582,4 @@ export function getMyTeam() {
dispatchError(err, 'getMyTeam'); dispatchError(err, 'getMyTeam');
} }
); );
} }
export function getConfig() {
if (isCallInProgress('getConfig')) {
return;
}
callTracker.getConfig = utils.getTimestamp();
client.getConfig(
function getConfigSuccess(data, textStatus, xhr) {
callTracker.getConfig = 0;
if (data && xhr.status !== 304) {
AppDispatcher.handleServerAction({
type: ActionTypes.RECIEVED_CONFIG,
settings: data
});
}
},
function getConfigFailure(err) {
callTracker.getConfig = 0;
dispatchError(err, 'getConfig');
}
);
}

Просмотреть файл

@@ -14,8 +14,6 @@ export function trackPage() {
} }
function handleError(methodName, xhr, status, err) { function handleError(methodName, xhr, status, err) {
var LTracker = global.window.LTracker || [];
var e = null; var e = null;
try { try {
e = JSON.parse(xhr.responseText); e = JSON.parse(xhr.responseText);
@@ -39,7 +37,6 @@ function handleError(methodName, xhr, status, err) {
console.error(msg); //eslint-disable-line no-console console.error(msg); //eslint-disable-line no-console
console.error(e); //eslint-disable-line no-console console.error(e); //eslint-disable-line no-console
LTracker.push(msg);
track('api', 'api_weberror', methodName, 'message', msg); track('api', 'api_weberror', methodName, 'message', msg);
@@ -990,17 +987,3 @@ export function updateValetFeature(data, success, error) {
track('api', 'api_teams_update_valet_feature'); track('api', 'api_teams_update_valet_feature');
} }
export function getConfig(success, error) {
$.ajax({
url: '/api/v1/config/get_all',
dataType: 'json',
type: 'GET',
ifModified: true,
success: success,
error: function onError(xhr, status, err) {
var e = handleError('getConfig', xhr, status, err);
error(e);
}
});
}

Просмотреть файл

@@ -1,48 +0,0 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
export var config = {
// Loggly configs
LogglyWriteKey: '',
LogglyConsoleErrors: true,
// Segment configs
SegmentWriteKey: '',
// Feature switches
AllowPublicLink: true,
AllowInviteNames: true,
RequireInviteNames: false,
AllowSignupDomainsWizard: false,
// Google Developer Key (for Youtube API links)
// Leave blank to disable
GoogleDeveloperKey: '',
// Privacy switches
ShowEmail: true,
// Links
TermsLink: '/static/help/configure_links.html',
PrivacyLink: '/static/help/configure_links.html',
AboutLink: '/static/help/configure_links.html',
HelpLink: '/static/help/configure_links.html',
ReportProblemLink: '/static/help/configure_links.html',
HomeLink: '',
// Toggle whether or not users are shown a message about agreeing to the Terms of Service during the signup process
ShowTermsDuringSignup: false,
ThemeColors: ['#2389d7', '#008a17', '#dc4fad', '#ac193d', '#0072c6', '#d24726', '#ff8f32', '#82ba00', '#03b3b2', '#008299', '#4617b4', '#8c0095', '#004b8b', '#004b8b', '#570000', '#380000', '#585858', '#000000']
};
// Flavor strings
export var strings = {
Team: 'team',
TeamPlural: 'teams',
Company: 'company',
CompanyPlural: 'companies'
};
global.window.config = config;

Просмотреть файл

@@ -9,7 +9,6 @@ var ActionTypes = Constants.ActionTypes;
var AsyncClient = require('./async_client.jsx'); var AsyncClient = require('./async_client.jsx');
var client = require('./client.jsx'); var client = require('./client.jsx');
var Autolinker = require('autolinker'); var Autolinker = require('autolinker');
import {config} from '../utils/config.js';
export function isEmail(email) { export function isEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
@@ -295,12 +294,12 @@ function getYoutubeEmbed(link) {
$('.post-list-holder-by-time').scrollTop($('.post-list-holder-by-time')[0].scrollHeight); $('.post-list-holder-by-time').scrollTop($('.post-list-holder-by-time')[0].scrollHeight);
} }
if (config.GoogleDeveloperKey) { if (global.window.config.GoogleDeveloperKey) {
$.ajax({ $.ajax({
async: true, async: true,
url: 'https://www.googleapis.com/youtube/v3/videos', url: 'https://www.googleapis.com/youtube/v3/videos',
type: 'GET', type: 'GET',
data: {part: 'snippet', id: youtubeId, key: config.GoogleDeveloperKey}, data: {part: 'snippet', id: youtubeId, key: global.window.config.GoogleDeveloperKey},
success: success success: success
}); });
} }

Просмотреть файл

@@ -7,10 +7,6 @@
Learn more, or download the source code from <a href=http://mattermost.com>http://mattermost.com</a>.</p> Learn more, or download the source code from <a href=http://mattermost.com>http://mattermost.com</a>.</p>
<h1>How to update this link</h1>
<p>In the source code, search for "config.js" and update the links pointing to this page to whatever policies and product description you prefer.
</p>
<h1>Join the community</h1> <h1>Join the community</h1>
<p>To take part in the community building Mattermost, please consider sharing comments, feature requests, votes, and contributions. If you like the project, please Tweet about us at <a href=https://twitter.com/mattermosthq>@mattermosthq</a>.</p> <p>To take part in the community building Mattermost, please consider sharing comments, feature requests, votes, and contributions. If you like the project, please Tweet about us at <a href=https://twitter.com/mattermosthq>@mattermosthq</a>.</p>

24
web/static/help/help.html Обычный файл
Просмотреть файл

@@ -0,0 +1,24 @@
<htmL>
<body>
<h1>Help with Mattermost</h1>
<p>Mattermost is a team communication service. It brings team real-time messaging and file sharing into one place, with easy archiving and search, accessible across PCs and phones.
</p>
<p>We built Mattermost to help teams focus on what matters most to them. It works for us, we hope it works for you too.
Learn more, or download the source code from <a href=http://mattermost.com>http://mattermost.com</a>.</p>
<h1>Join the community</h1>
<p>To take part in the community building Mattermost, please consider sharing comments, feature requests, votes, and contributions. If you like the project, please Tweet about us at <a href=https://twitter.com/mattermosthq>@mattermosthq</a>.</p>
<p>Here's some links to get started:<br>
<ul>
<li><a href="https://github.com/mattermost/platform">Follow Mattermost on Github</a></li>
<li><a href="http://forum.mattermost.org/">Ask us anything at http://forum.mattermost.org/</a></li>
<li><a href="http://www.mattermost.org/feature-requests/">Review the Mattermost feature list </a></li>
<li><a href="http://www.mattermost.org/download/">Download our source code and install instructions</a></li>
<li><a href="http://www.mattermost.org/feature-requests/">Share feature requests and upvotes</a></li>
<li><a href="http://www.mattermost.org/filing-issues/">File any bugs you find with our Issue tracking system</a></li>
</ul>
</p>
</body>
</html>

24
web/static/help/privacy.html Обычный файл
Просмотреть файл

@@ -0,0 +1,24 @@
<htmL>
<body>
<h1>Mattermost Privacy</h1>
<p>Mattermost is a team communication service. It brings team real-time messaging and file sharing into one place, with easy archiving and search, accessible across PCs and phones.
</p>
<p>We built Mattermost to help teams focus on what matters most to them. It works for us, we hope it works for you too.
Learn more, or download the source code from <a href=http://mattermost.com>http://mattermost.com</a>.</p>
<h1>Join the community</h1>
<p>To take part in the community building Mattermost, please consider sharing comments, feature requests, votes, and contributions. If you like the project, please Tweet about us at <a href=https://twitter.com/mattermosthq>@mattermosthq</a>.</p>
<p>Here's some links to get started:<br>
<ul>
<li><a href="https://github.com/mattermost/platform">Follow Mattermost on Github</a></li>
<li><a href="http://forum.mattermost.org/">Ask us anything at http://forum.mattermost.org/</a></li>
<li><a href="http://www.mattermost.org/feature-requests/">Review the Mattermost feature list </a></li>
<li><a href="http://www.mattermost.org/download/">Download our source code and install instructions</a></li>
<li><a href="http://www.mattermost.org/feature-requests/">Share feature requests and upvotes</a></li>
<li><a href="http://www.mattermost.org/filing-issues/">File any bugs you find with our Issue tracking system</a></li>
</ul>
</p>
</body>
</html>

24
web/static/help/report_problem.html Обычный файл
Просмотреть файл

@@ -0,0 +1,24 @@
<htmL>
<body>
<h1>Report a Problem About Mattermost</h1>
<p>Mattermost is a team communication service. It brings team real-time messaging and file sharing into one place, with easy archiving and search, accessible across PCs and phones.
</p>
<p>We built Mattermost to help teams focus on what matters most to them. It works for us, we hope it works for you too.
Learn more, or download the source code from <a href=http://mattermost.com>http://mattermost.com</a>.</p>
<h1>Join the community</h1>
<p>To take part in the community building Mattermost, please consider sharing comments, feature requests, votes, and contributions. If you like the project, please Tweet about us at <a href=https://twitter.com/mattermosthq>@mattermosthq</a>.</p>
<p>Here's some links to get started:<br>
<ul>
<li><a href="https://github.com/mattermost/platform">Follow Mattermost on Github</a></li>
<li><a href="http://forum.mattermost.org/">Ask us anything at http://forum.mattermost.org/</a></li>
<li><a href="http://www.mattermost.org/feature-requests/">Review the Mattermost feature list </a></li>
<li><a href="http://www.mattermost.org/download/">Download our source code and install instructions</a></li>
<li><a href="http://www.mattermost.org/feature-requests/">Share feature requests and upvotes</a></li>
<li><a href="http://www.mattermost.org/filing-issues/">File any bugs you find with our Issue tracking system</a></li>
</ul>
</p>
</body>
</html>

24
web/static/help/terms.html Обычный файл
Просмотреть файл

@@ -0,0 +1,24 @@
<htmL>
<body>
<h1>Mattermost Terms</h1>
<p>Mattermost is a team communication service. It brings team real-time messaging and file sharing into one place, with easy archiving and search, accessible across PCs and phones.
</p>
<p>We built Mattermost to help teams focus on what matters most to them. It works for us, we hope it works for you too.
Learn more, or download the source code from <a href=http://mattermost.com>http://mattermost.com</a>.</p>
<h1>Join the community</h1>
<p>To take part in the community building Mattermost, please consider sharing comments, feature requests, votes, and contributions. If you like the project, please Tweet about us at <a href=https://twitter.com/mattermosthq>@mattermosthq</a>.</p>
<p>Here's some links to get started:<br>
<ul>
<li><a href="https://github.com/mattermost/platform">Follow Mattermost on Github</a></li>
<li><a href="http://forum.mattermost.org/">Ask us anything at http://forum.mattermost.org/</a></li>
<li><a href="http://www.mattermost.org/feature-requests/">Review the Mattermost feature list </a></li>
<li><a href="http://www.mattermost.org/download/">Download our source code and install instructions</a></li>
<li><a href="http://www.mattermost.org/feature-requests/">Share feature requests and upvotes</a></li>
<li><a href="http://www.mattermost.org/filing-issues/">File any bugs you find with our Issue tracking system</a></li>
</ul>
</p>
</body>
</html>

Просмотреть файл

@@ -50,7 +50,7 @@
<div id="activity_log_modal"></div> <div id="activity_log_modal"></div>
<div id="removed_from_channel_modal"></div> <div id="removed_from_channel_modal"></div>
<script> <script>
window.setup_channel_page('{{ .Props.TeamDisplayName }}', '{{ .Props.TeamType }}', '{{ .Props.TeamId }}', '{{ .Props.ChannelName }}', '{{ .Props.ChannelId }}'); window.setup_channel_page({{ .Props }});
$('body').tooltip( {selector: '[data-toggle=tooltip]'} ); $('body').tooltip( {selector: '[data-toggle=tooltip]'} );
$('.modal-body').css('max-height', $(window).height() * 0.7); $('.modal-body').css('max-height', $(window).height() * 0.7);
$('.modal-body').perfectScrollbar(); $('.modal-body').perfectScrollbar();

Просмотреть файл

@@ -1,7 +1,7 @@
{{define "footer"}} {{define "footer"}}
<div class="footer-pane col-xs-12"> <div class="footer-pane col-xs-12">
<div class="col-xs-12"> <div class="col-xs-12">
<span class="pull-right footer-site-name">{{ .SiteName }}</span> <span class="pull-right footer-site-name">{{ .ClientProps.SiteName }}</span>
</div> </div>
<div class="col-xs-12"> <div class="col-xs-12">
<span class="pull-right footer-link copyright">© 2015 SpinPunch</span> <span class="pull-right footer-link copyright">© 2015 SpinPunch</span>
@@ -12,9 +12,9 @@
</div> </div>
</div> </div>
<script> <script>
document.getElementById("help_link").setAttribute("href", config.HelpLink); document.getElementById("help_link").setAttribute("href", '/static/help/help.html');
document.getElementById("terms_link").setAttribute("href", config.TermsLink); document.getElementById("terms_link").setAttribute("href", '/static/help/terms.html');
document.getElementById("privacy_link").setAttribute("href", config.PrivacyLink); document.getElementById("privacy_link").setAttribute("href", '/static/help/privacy.html');
document.getElementById("about_link").setAttribute("href", config.AboutLink); document.getElementById("about_link").setAttribute("href", '/static/help/about.html');
</script> </script>
{{end}} {{end}}

Просмотреть файл

@@ -3,14 +3,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<title>{{ .Title }}</title> <title>{{ .Props.Title }}</title>
<!-- iOS add to homescreen --> <!-- iOS add to homescreen -->
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default"> <meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="{{ .Title }}"> <meta name="apple-mobile-web-app-title" content="{{ .Props.Title }}">
<meta name="application-name" content="{{ .Title }}"> <meta name="application-name" content="{{ .Props.Title }}">
<meta name="format-detection" content="telephone=no"> <meta name="format-detection" content="telephone=no">
<!-- iOS add to homescreen --> <!-- iOS add to homescreen -->
@@ -18,6 +18,11 @@
<link rel="manifest" href="/static/config/manifest.json"> <link rel="manifest" href="/static/config/manifest.json">
<!-- Android add to homescreen --> <!-- Android add to homescreen -->
<script>
window.config = {{ .ClientProps }};
</script>
<link rel="stylesheet" href="/static/css/bootstrap-3.3.5.min.css"> <link rel="stylesheet" href="/static/css/bootstrap-3.3.5.min.css">
<link rel="stylesheet" href="/static/css/jasny-bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="/static/css/jasny-bootstrap.min.css" rel="stylesheet">
@@ -35,9 +40,7 @@
<script src="/static/js/jquery-dragster/jquery.dragster.js"></script> <script src="/static/js/jquery-dragster/jquery.dragster.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['annotationchart']}]}"></script>
<script type="text/javascript" src="https://cloudfront.loggly.com/js/loggly.tracker.js" async></script>
<style id="antiClickjack">body{display:none !important;}</style> <style id="antiClickjack">body{display:none !important;}</style>
<script src="/static/js/bundle.js"></script> <script src="/static/js/bundle.js"></script>
<script type="text/javascript"> <script type="text/javascript">
@@ -46,28 +49,8 @@
blocker.parentNode.removeChild(blocker); blocker.parentNode.removeChild(blocker);
} }
</script> </script>
<script>
if (window.config == null) {
window.config = {};
}
window.config.SiteName = '{{ .SiteName }}';
window.config.ProfileWidth = '{{ .Props.ProfileWidth }}'
window.config.ProfileHeight = '{{ .Props.ProfileHeight }}'
</script>
<script>
if (window.config.LogglyWriteKey != null && window.config.LogglyWriteKey !== "") {
var LTracker = LTracker || [];
window.LTracker = LTracker;
LTracker.push({'logglyKey': window.config.LogglyWriteKey, 'sendConsoleErrors' : window.config.LogglyConsoleErrors });
} else {
window.LTracker = [];
console.warn("config.js missing LogglyWriteKey, Loggly analytics is not reporting");
}
</script>
<script type="text/javascript"> <script type="text/javascript">
if (window.config.SegmentWriteKey != null && window.config.SegmentWriteKey !== "") { if (window.config.SegmentDeveloperKey != null && window.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"; !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.SegmentWriteKey); analytics.load(window.config.SegmentWriteKey);
var user = window.UserStore.getCurrentUser(true); var user = window.UserStore.getCurrentUser(true);
@@ -88,7 +71,6 @@
analytics = {}; analytics = {};
analytics.page = function(){}; analytics.page = function(){};
analytics.track = function(){}; analytics.track = function(){};
console.warn("config.js missing SegmentWriteKey, SegmentIO analytics is not tracking");
} }
</script> </script>
<!-- Snowplow starts plowing --> <!-- Snowplow starts plowing -->
@@ -100,7 +82,7 @@
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.4.2/sp.js","snowplow")); n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.4.2/sp.js","snowplow"));
window.snowplow('newTracker', 'cf', '{{ .Props.AnalyticsUrl }}', { window.snowplow('newTracker', 'cf', '{{ .Props.AnalyticsUrl }}', {
appId: '{{ .SiteName }}' appId: window.config.SiteName
}); });
var user = window.UserStore.getCurrentUser(true); var user = window.UserStore.getCurrentUser(true);
@@ -111,7 +93,6 @@
window.snowplow('trackPageView'); window.snowplow('trackPageView');
} else { } else {
window.snowplow = function(){}; window.snowplow = function(){};
console.warn("config.json missing AnalyticsUrl, Snowplow analytics is not tracking");
} }
</script> </script>
<!-- Snowplow stops plowing --> <!-- Snowplow stops plowing -->

Просмотреть файл

@@ -17,7 +17,7 @@
</div> </div>
</div> </div>
<script> <script>
window.setup_home_page({{.Props.TeamURL}}); window.setup_home_page({{ .Props }});
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@@ -20,7 +20,7 @@
</div> </div>
</div> </div>
<script> <script>
window.setup_login_page('{{.Props.TeamDisplayName}}', '{{.Props.TeamName}}', '{{.Props.AuthServices}}'); window.setup_login_page({{ .Props }});
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@@ -9,7 +9,7 @@
</div> </div>
</div> </div>
<script> <script>
window.setup_password_reset_page('{{ .Props.IsReset }}', '{{ .Props.TeamDisplayName }}', '{{ .Props.TeamName }}', '{{ .Props.Hash }}', '{{ .Props.Data }}'); window.setup_password_reset_page({{ .Props }});
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@@ -9,7 +9,7 @@
<div class="col-sm-12"> <div class="col-sm-12">
<div class="signup-team__container"> <div class="signup-team__container">
<img class="signup-team-logo" src="/static/images/logo.png" /> <img class="signup-team-logo" src="/static/images/logo.png" />
<h1>{{ .SiteName }}</h1> <h1>{{ .ClientProps.SiteName }}</h1>
<h4 class="color--light">All team communication in one place, searchable and accessible anywhere</h4> <h4 class="color--light">All team communication in one place, searchable and accessible anywhere</h4>
<div id="signup-team"></div> <div id="signup-team"></div>
</div> </div>
@@ -22,7 +22,7 @@
</div> </div>
</div> </div>
<script> <script>
window.setup_signup_team_page('{{.Props.AuthServices}}'); window.setup_signup_team_page({{ .Props }});
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@@ -19,7 +19,7 @@
</div> </div>
</div> </div>
<script> <script>
window.setup_signup_team_complete_page('{{.Props.Email}}', '{{.Props.Data}}', '{{.Props.Hash}}'); window.setup_signup_team_complete_page({{ .Props }});
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@@ -19,7 +19,7 @@
</div> </div>
</div> </div>
<script> <script>
window.setup_signup_user_complete_page('{{.Props.Email}}', '{{.Props.TeamName}}', '{{.Props.TeamDisplayName}}', '{{.Props.TeamId}}', '{{.Props.Data}}', '{{.Props.Hash}}', '{{.Props.AuthServices}}'); window.setup_signup_user_complete_page({{ .Props }});
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@@ -9,7 +9,7 @@
</div> </div>
</div> </div>
<script> <script>
window.setupVerifyPage('{{.Props.IsVerified}}', '{{.Props.TeamURL}}', '{{.Props.UserEmail}}'); window.setupVerifyPage({{ .Props }});
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@@ -11,7 +11,7 @@
<div class="row main"> <div class="row main">
<div class="app__content"> <div class="app__content">
<div class="welcome-info"> <div class="welcome-info">
<h1>Welcome to {{ .SiteName }}!</h1> <h1>Welcome to {{ .ClientProps.SiteName }}!</h1>
<p> <p>
You do not appear to be part of any teams. Please contact your 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. administrator to have him send you an invitation to a private team.

Просмотреть файл

@@ -30,10 +30,8 @@ func NewHtmlTemplatePage(templateName string, title string) *HtmlTemplatePage {
} }
props := make(map[string]string) props := make(map[string]string)
props["AnalyticsUrl"] = utils.Cfg.ServiceSettings.AnalyticsUrl props["Title"] = title
props["ProfileHeight"] = fmt.Sprintf("%v", utils.Cfg.ImageSettings.ProfileHeight) return &HtmlTemplatePage{TemplateName: templateName, Props: props, ClientProps: utils.ClientProperties}
props["ProfileWidth"] = fmt.Sprintf("%v", utils.Cfg.ImageSettings.ProfileWidth)
return &HtmlTemplatePage{TemplateName: templateName, Title: title, SiteName: utils.Cfg.ServiceSettings.SiteName, Props: props}
} }
func (me *HtmlTemplatePage) Render(c *api.Context, w http.ResponseWriter) { func (me *HtmlTemplatePage) Render(c *api.Context, w http.ResponseWriter) {
@@ -344,7 +342,7 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) {
} }
page := NewHtmlTemplatePage("channel", "") page := NewHtmlTemplatePage("channel", "")
page.Title = name + " - " + team.DisplayName + " " + page.SiteName page.Props["Title"] = name + " - " + team.DisplayName + " " + page.ClientProps["SiteName"]
page.Props["TeamDisplayName"] = team.DisplayName page.Props["TeamDisplayName"] = team.DisplayName
page.Props["TeamType"] = team.Type page.Props["TeamType"] = team.Type
page.Props["TeamId"] = team.Id page.Props["TeamId"] = team.Id
@@ -447,7 +445,7 @@ func resetPassword(c *api.Context, w http.ResponseWriter, r *http.Request) {
} }
page := NewHtmlTemplatePage("password_reset", "") page := NewHtmlTemplatePage("password_reset", "")
page.Title = "Reset Password - " + page.SiteName page.Props["Title"] = "Reset Password " + page.ClientProps["SiteName"]
page.Props["TeamDisplayName"] = teamDisplayName page.Props["TeamDisplayName"] = teamDisplayName
page.Props["Hash"] = hash page.Props["Hash"] = hash
page.Props["Data"] = data page.Props["Data"] = data