Этот коммит содержится в:
Jack
2015-09-28 08:14:57 -07:00
родитель aa6da728ba a055fd10b8
Коммит 503501ab3b
106 изменённых файлов: 2374 добавлений и 1052 удалений

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

@@ -1,6 +1,6 @@
# Mattermost Changelog # Mattermost Changelog
## UNDER DEVELOPMENT - Release v0.8.0 (Beta2) ## UNDER DEVELOPMENT - Release v1.0.0
The "UNDER DEVELOPMENT" section of the Mattermost changelog appears in the product's `master` branch to note key changes committed to master and are on their way to the next stable release. When a stable release is pushed the "UNDER DEVELOPMENT" heading is removed from the final changelog of the release. The "UNDER DEVELOPMENT" section of the Mattermost changelog appears in the product's `master` branch to note key changes committed to master and are on their way to the next stable release. When a stable release is pushed the "UNDER DEVELOPMENT" heading is removed from the final changelog of the release.
@@ -15,11 +15,23 @@ The "UNDER DEVELOPMENT" section of the Mattermost changelog appears in the produ
Messaging, Comments and Notifications Messaging, Comments and Notifications
- (Preview) Added support for emoji codes rendering to image files - Support for emoji codes rendering to image files
- Full markdown support in messages, comments, and channel description
- Added ability to play video and audio files
Admin Console System Console
- (Preview) Ability to view server logs and change config settings - UI to change config.json settings
- Ability to view log files from console
User Interface
- Ability to set custom theme colors
- Replaced single color themes with pre-set themes
- Added ability to import themes from Slack
Integrations
- (Preview) Initial support for incoming webhooks
### Improvements ### Improvements
@@ -30,6 +42,7 @@ Documentation
- Added Code Contribution Guidelines - Added Code Contribution Guidelines
- Added new hardware sizing recommendations - Added new hardware sizing recommendations
- Consolidated licensing information into LICENSE.txt and NOTICE.txt - Consolidated licensing information into LICENSE.txt and NOTICE.txt
- Added markdown documentation
Performance Performance
@@ -41,11 +54,11 @@ Code Quality
UI UI
- Added version, build number, build date and build hash under Account Settings -> Security (to be moved to "About" dialog later) - Added version, build number, build date and build hash under Account Settings -> Security
### Bug Fixes ### Bug Fixes
- Fixed performance issue with slow typing on iOS - Numerous performance improvements
- Fixed issue so that SSO option automatically set EmailVerified=true (it was false previously) - Fixed issue so that SSO option automatically set EmailVerified=true (it was false previously)
### Contributors ### Contributors

4
Godeps/Godeps.json сгенерированный
Просмотреть файл

@@ -84,8 +84,8 @@
}, },
{ {
"ImportPath": "github.com/mssola/user_agent", "ImportPath": "github.com/mssola/user_agent",
"Comment": "v0.4.1-2-g35c7f18", "Comment": "v0.4.1-4-ga163d6a",
"Rev": "35c7f18f5261cc18c698a461053c119aebaf8542" "Rev": "a163d6a569f1cd264d2f8b2bf3c5d04ace5995eb"
}, },
{ {
"ImportPath": "github.com/rwcarlsen/goexif/exif", "ImportPath": "github.com/rwcarlsen/goexif/exif",

1
Godeps/_workspace/src/github.com/mssola/user_agent/.travis.yml сгенерированный поставляемый
Просмотреть файл

@@ -5,6 +5,7 @@ go:
- 1.2 - 1.2
- 1.3 - 1.3
- 1.4 - 1.4
- 1.5
- tip - tip
matrix: matrix:
allow_failures: allow_failures:

8
Godeps/_workspace/src/github.com/mssola/user_agent/all_test.go сгенерированный поставляемый
Просмотреть файл

@@ -40,6 +40,10 @@ var uastrings = []struct {
{"IE11b32Win7b64MDDRJS", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; MDDRJS; rv:11.0) like Gecko"}, {"IE11b32Win7b64MDDRJS", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; MDDRJS; rv:11.0) like Gecko"},
{"IE11Compatibility", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0)"}, {"IE11Compatibility", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0)"},
// Microsoft Edge
{"EdgeDesktop", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"},
{"EdgeMobile", "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10240"},
// Gecko // Gecko
{"FirefoxMac", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b8) Gecko/20100101 Firefox/4.0b8"}, {"FirefoxMac", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b8) Gecko/20100101 Firefox/4.0b8"},
{"FirefoxMacLoc", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13"}, {"FirefoxMacLoc", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13"},
@@ -129,6 +133,10 @@ var expected = []string{
"Mozilla:5.0 Platform:Windows OS:Windows 7 Browser:Internet Explorer-11.0 Engine:Trident Bot:false Mobile:false", "Mozilla:5.0 Platform:Windows OS:Windows 7 Browser:Internet Explorer-11.0 Engine:Trident Bot:false Mobile:false",
"Mozilla:4.0 Platform:Windows OS:Windows 8.1 Browser:Internet Explorer-7.0 Engine:Trident Bot:false Mobile:false", "Mozilla:4.0 Platform:Windows OS:Windows 8.1 Browser:Internet Explorer-7.0 Engine:Trident Bot:false Mobile:false",
// Microsoft Edge
"Mozilla:5.0 Platform:Windows OS:Windows NT 10.0 Browser:Edge-12.10240 Engine:EdgeHTML Bot:false Mobile:false",
"Mozilla:5.0 Platform:Windows OS:Windows Phone 10.0 Browser:Edge-12.10240 Engine:EdgeHTML Bot:false Mobile:true",
// Gecko // Gecko
"Mozilla:5.0 Platform:Macintosh OS:Intel Mac OS X 10.6 Browser:Firefox-4.0b8 Engine:Gecko-20100101 Bot:false Mobile:false", "Mozilla:5.0 Platform:Macintosh OS:Intel Mac OS X 10.6 Browser:Firefox-4.0b8 Engine:Gecko-20100101 Bot:false Mobile:false",
"Mozilla:5.0 Platform:Macintosh OS:Intel Mac OS X 10.6 Localization:en-US Browser:Firefox-3.6.13 Engine:Gecko-20101203 Bot:false Mobile:false", "Mozilla:5.0 Platform:Macintosh OS:Intel Mac OS X 10.6 Localization:en-US Browser:Firefox-3.6.13 Engine:Gecko-20101203 Bot:false Mobile:false",

18
Godeps/_workspace/src/github.com/mssola/user_agent/browser.go сгенерированный поставляемый
Просмотреть файл

@@ -48,13 +48,21 @@ func (p *UserAgent) detectBrowser(sections []section) {
if slen > 2 { if slen > 2 {
p.browser.Version = sections[2].version p.browser.Version = sections[2].version
if engine.name == "AppleWebKit" { if engine.name == "AppleWebKit" {
if sections[slen-1].name == "OPR" { switch sections[slen-1].name {
case "Edge":
p.browser.Name = "Edge"
p.browser.Version = sections[slen-1].version
p.browser.Engine = "EdgeHTML"
p.browser.EngineVersion = ""
case "OPR":
p.browser.Name = "Opera" p.browser.Name = "Opera"
p.browser.Version = sections[slen-1].version p.browser.Version = sections[slen-1].version
} else if sections[2].name == "Chrome" { default:
p.browser.Name = "Chrome" if sections[2].name == "Chrome" {
} else { p.browser.Name = "Chrome"
p.browser.Name = "Safari" } else {
p.browser.Name = "Safari"
}
} }
} else if engine.name == "Gecko" { } else if engine.name == "Gecko" {
name := sections[2].name name := sections[2].name

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

@@ -724,6 +724,77 @@ Legal Terms
Our home page can be found at Our home page can be found at
http://www.freetype.org http://www.freetype.org
--- end of FTL.TXT --- --- end of FTL.TXT ---
---
This product contains a modified portion of 'gemoji', a collection of emoji images and names by Apple Inc. and other contributors.
* HOMEPAGE:
* https://github.com/github/gemoji/blob/master/LICENSE
* LICENSE:
octocat, squirrel, shipit
Copyright (c) 2013 GitHub Inc. All rights reserved.
bowtie, neckbeard, fu
Copyright (c) 2013 37signals, LLC. All rights reserved.
feelsgood, finnadie, goberserk, godmode, hurtrealbad, rage 1-4, suspect
Copyright (c) 2013 id Software. All rights reserved.
trollface
Copyright (c) 2013 whynne@deviantart. All rights reserved.
All other images
Copyright (c) 2013 Apple Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
---
This product contains a modified portion of 'marked', a full-featured markdown parser and compiler, written in JavaScript. Built for speed.
by Christopher Jeffrey
* HOMEPAGE:
* https://github.com/chjj/marked
* LICENSE:
Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

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

@@ -456,18 +456,19 @@ func IsPrivateIpAddress(ipAddress string) bool {
} }
func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request) { func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request) {
props := make(map[string]string)
props["Message"] = err.Message
props["Details"] = err.DetailedError
protocol := GetProtocol(r) pathParts := strings.Split(r.URL.Path, "/")
SiteURL := protocol + "://" + r.Host if len(pathParts) > 1 {
props["SiteURL"] = GetProtocol(r) + "://" + r.Host + "/" + pathParts[1]
m := make(map[string]string) } else {
m["Message"] = err.Message props["SiteURL"] = GetProtocol(r) + "://" + r.Host
m["Details"] = err.DetailedError }
m["SiteName"] = utils.Cfg.TeamSettings.SiteName
m["SiteURL"] = SiteURL
w.WriteHeader(err.StatusCode) w.WriteHeader(err.StatusCode)
ServerTemplates.ExecuteTemplate(w, "error.html", m) ServerTemplates.ExecuteTemplate(w, "error.html", Page{Props: props, ClientProps: utils.ClientProperties})
} }
func Handle404(w http.ResponseWriter, r *http.Request) { func Handle404(w http.ResponseWriter, r *http.Request) {

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

@@ -87,7 +87,7 @@ func ExportTeams(writer ExportWriter, options *ExportOptions) *model.AppError {
// Get the teams // Get the teams
var teams []*model.Team var teams []*model.Team
if len(options.TeamsToExport) == 0 { if len(options.TeamsToExport) == 0 {
if result := <-Srv.Store.Team().GetForExport(); result.Err != nil { if result := <-Srv.Store.Team().GetAll(); result.Err != nil {
return result.Err return result.Err
} else { } else {
teams = result.Data.([]*model.Team) teams = result.Data.([]*model.Team)

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

@@ -13,6 +13,7 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/mattermost/platform/model" "github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils" "github.com/mattermost/platform/utils"
"github.com/mssola/user_agent"
"github.com/rwcarlsen/goexif/exif" "github.com/rwcarlsen/goexif/exif"
_ "golang.org/x/image/bmp" _ "golang.org/x/image/bmp"
"image" "image"
@@ -407,6 +408,19 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "max-age=2592000, public") w.Header().Set("Cache-Control", "max-age=2592000, public")
w.Header().Set("Content-Length", strconv.Itoa(len(f))) w.Header().Set("Content-Length", strconv.Itoa(len(f)))
w.Header().Set("Content-Type", mime.TypeByExtension(filepath.Ext(filename))) w.Header().Set("Content-Type", mime.TypeByExtension(filepath.Ext(filename)))
// attach extra headers to trigger a download on IE and Edge
ua := user_agent.New(r.UserAgent())
bname, _ := ua.Browser()
if bname == "Edge" || bname == "Internet Explorer" {
// trim off anything before the final / so we just get the file's name
parts := strings.Split(filename, "/")
w.Header().Set("Content-Type", "application/octet-stream")
w.Header().Set("Content-Disposition", "attachment;filename=\""+parts[len(parts)-1]+"\"")
}
w.Write(f) w.Write(f)
} }

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

@@ -6,7 +6,6 @@ package api
import ( import (
l4g "code.google.com/p/log4go" l4g "code.google.com/p/log4go"
"github.com/mattermost/platform/model" "github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
) )
// //
@@ -24,9 +23,6 @@ func ImportPost(post *model.Post) {
func ImportUser(user *model.User) *model.User { func ImportUser(user *model.User) *model.User {
user.MakeNonNil() user.MakeNonNil()
if len(user.Props["theme"]) == 0 {
user.AddProp("theme", utils.Cfg.TeamSettings.DefaultThemeColor)
}
if result := <-Srv.Store.User().Save(user); result.Err != nil { if result := <-Srv.Store.User().Save(user); result.Err != nil {
l4g.Error("Error saving user. err=%v", result.Err) l4g.Error("Error saving user. err=%v", result.Err)

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

@@ -25,12 +25,12 @@ func InitTeam(r *mux.Router) {
sr.Handle("/create_from_signup", ApiAppHandler(createTeamFromSignup)).Methods("POST") sr.Handle("/create_from_signup", ApiAppHandler(createTeamFromSignup)).Methods("POST")
sr.Handle("/create_with_sso/{service:[A-Za-z]+}", ApiAppHandler(createTeamFromSSO)).Methods("POST") sr.Handle("/create_with_sso/{service:[A-Za-z]+}", ApiAppHandler(createTeamFromSSO)).Methods("POST")
sr.Handle("/signup", ApiAppHandler(signupTeam)).Methods("POST") sr.Handle("/signup", ApiAppHandler(signupTeam)).Methods("POST")
sr.Handle("/all", ApiUserRequired(getAll)).Methods("GET")
sr.Handle("/find_team_by_name", ApiAppHandler(findTeamByName)).Methods("POST") sr.Handle("/find_team_by_name", ApiAppHandler(findTeamByName)).Methods("POST")
sr.Handle("/find_teams", ApiAppHandler(findTeams)).Methods("POST") sr.Handle("/find_teams", ApiAppHandler(findTeams)).Methods("POST")
sr.Handle("/email_teams", ApiAppHandler(emailTeams)).Methods("POST") sr.Handle("/email_teams", ApiAppHandler(emailTeams)).Methods("POST")
sr.Handle("/invite_members", ApiUserRequired(inviteMembers)).Methods("POST") sr.Handle("/invite_members", ApiUserRequired(inviteMembers)).Methods("POST")
sr.Handle("/update_name", ApiUserRequired(updateTeamDisplayName)).Methods("POST") sr.Handle("/update_name", ApiUserRequired(updateTeamDisplayName)).Methods("POST")
sr.Handle("/update_valet_feature", ApiUserRequired(updateValetFeature)).Methods("POST")
sr.Handle("/me", ApiUserRequired(getMyTeam)).Methods("GET") sr.Handle("/me", ApiUserRequired(getMyTeam)).Methods("GET")
// These should be moved to the global admain console // These should be moved to the global admain console
sr.Handle("/import_team", ApiUserRequired(importTeam)).Methods("POST") sr.Handle("/import_team", ApiUserRequired(importTeam)).Methods("POST")
@@ -302,6 +302,53 @@ func isTreamCreationAllowed(c *Context, email string) bool {
return true return true
} }
func getAll(c *Context, w http.ResponseWriter, r *http.Request) {
if !c.HasSystemAdminPermissions("getLogs") {
return
}
if result := <-Srv.Store.Team().GetAll(); result.Err != nil {
c.Err = result.Err
return
} else {
teams := result.Data.([]*model.Team)
m := make(map[string]*model.Team)
for _, v := range teams {
m[v.Id] = v
}
w.Write([]byte(model.TeamMapToJson(m)))
}
}
func revokeAllSessions(c *Context, w http.ResponseWriter, r *http.Request) {
props := model.MapFromJson(r.Body)
id := props["id"]
if result := <-Srv.Store.Session().Get(id); result.Err != nil {
c.Err = result.Err
return
} else {
session := result.Data.(*model.Session)
c.LogAudit("revoked_all=" + id)
if session.IsOAuth {
RevokeAccessToken(session.Token)
} else {
sessionCache.Remove(session.Token)
if result := <-Srv.Store.Session().Remove(session.Id); result.Err != nil {
c.Err = result.Err
return
} else {
w.Write([]byte(model.MapToJson(props)))
return
}
}
}
}
func findTeamByName(c *Context, w http.ResponseWriter, r *http.Request) { func findTeamByName(c *Context, w http.ResponseWriter, r *http.Request) {
m := model.MapFromJson(r.Body) m := model.MapFromJson(r.Body)
@@ -533,52 +580,6 @@ func updateTeamDisplayName(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write([]byte(model.MapToJson(props))) w.Write([]byte(model.MapToJson(props)))
} }
func updateValetFeature(c *Context, w http.ResponseWriter, r *http.Request) {
props := model.MapFromJson(r.Body)
allowValetStr := props["allow_valet"]
if len(allowValetStr) == 0 {
c.SetInvalidParam("updateValetFeature", "allow_valet")
return
}
teamId := props["team_id"]
if len(teamId) > 0 && len(teamId) != 26 {
c.SetInvalidParam("updateValetFeature", "team_id")
return
} else if len(teamId) == 0 {
teamId = c.Session.TeamId
}
tchan := Srv.Store.Team().Get(teamId)
if !c.HasPermissionsToTeam(teamId, "updateValetFeature") {
return
}
if !model.IsInRole(c.Session.Roles, model.ROLE_TEAM_ADMIN) {
c.Err = model.NewAppError("updateValetFeature", "You do not have the appropriate permissions", "userId="+c.Session.UserId)
c.Err.StatusCode = http.StatusForbidden
return
}
var team *model.Team
if tResult := <-tchan; tResult.Err != nil {
c.Err = tResult.Err
return
} else {
team = tResult.Data.(*model.Team)
}
if result := <-Srv.Store.Team().Update(team); result.Err != nil {
c.Err = result.Err
return
}
w.Write([]byte(model.MapToJson(props)))
}
func getMyTeam(c *Context, w http.ResponseWriter, r *http.Request) { func getMyTeam(c *Context, w http.ResponseWriter, r *http.Request) {
if len(c.Session.TeamId) == 0 { if len(c.Session.TeamId) == 0 {

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

@@ -132,6 +132,39 @@ func TestFindTeamByEmail(t *testing.T) {
} }
} }
func TestGetAllTeams(t *testing.T) {
Setup()
team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd")
if _, err := Client.GetAllTeams(); err == nil {
t.Fatal("you shouldn't have permissions")
}
c := &Context{}
c.RequestId = model.NewId()
c.IpAddress = "cmd_line"
UpdateRoles(c, user, model.ROLE_SYSTEM_ADMIN)
Client.LoginByEmail(team.Name, user.Email, "pwd")
if r1, err := Client.GetAllTeams(); err != nil {
t.Fatal(err)
} else {
teams := r1.Data.(map[string]*model.Team)
if teams[team.Id].Name != team.Name {
t.Fatal()
}
}
}
/* /*
XXXXXX investigate and fix failing test XXXXXX investigate and fix failing test

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

@@ -23,7 +23,7 @@
<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>{{ .ClientProps.SiteName }} needs your help:</h2> <h2>{{ .ClientProps.SiteName }} needs your help:</h2>
<p>{{.Message}}</p> <p>{{ .Props.Message }}</p>
<a href="{{.Props.SiteURL}}">Go back to team site</a> <a href="{{.Props.SiteURL}}">Go back to team site</a>
</div> </div>
</div> </div>

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

@@ -22,9 +22,6 @@
<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>
{{ .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> {{ .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>
Learn more by <a href="{{.Props.TourUrl}}" style="text-decoration: none; color:#2389D7;">taking a tour</a>
</p>
</td> </td>
</tr> </tr>
<tr> <tr>

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

@@ -17,15 +17,9 @@
<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 {{.ClientProps.SiteName}}!</h2> <h2 style="font-weight: normal; margin-top: 10px;">You can sign-in to your new team from the web address:</h2>
<p>Please let me know if you have any questions.<br>Enjoy your stay at <a href="{{.Props.TeamURL}}">{{.ClientProps.SiteName}}</a>.</p> <a href="{{.Props.TeamURL}}">{{.Props.TeamURL}}</a>
</td> <p>Mattermost lets you share messages and files from your PC or phone, with instant search and archiving.</p>
</tr>
<tr>
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
Any questions at all, mail us any time: <a href="mailto:{{.ClientProps.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientProps.FeedbackEmail}}</a>.<br>
Best wishes,<br>
The {{.ClientProps.SiteName}} Team<br>
</td> </td>
</tr> </tr>
</table> </table>

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

@@ -1 +1 @@
{{define "welcome_subject"}}Welcome to {{ .ClientProps.SiteName }}{{end}} {{define "welcome_subject"}}You joined {{ .Props.TeamDisplayName }}{{end}}

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

@@ -51,6 +51,7 @@ func InitUser(r *mux.Router) {
sr.Handle("/me", ApiAppHandler(getMe)).Methods("GET") sr.Handle("/me", ApiAppHandler(getMe)).Methods("GET")
sr.Handle("/status", ApiUserRequiredActivity(getStatuses, false)).Methods("GET") sr.Handle("/status", ApiUserRequiredActivity(getStatuses, false)).Methods("GET")
sr.Handle("/profiles", ApiUserRequired(getProfiles)).Methods("GET") sr.Handle("/profiles", ApiUserRequired(getProfiles)).Methods("GET")
sr.Handle("/profiles/{id:[A-Za-z0-9]+}", ApiUserRequired(getProfiles)).Methods("GET")
sr.Handle("/{id:[A-Za-z0-9]+}", ApiUserRequired(getUser)).Methods("GET") sr.Handle("/{id:[A-Za-z0-9]+}", ApiUserRequired(getUser)).Methods("GET")
sr.Handle("/{id:[A-Za-z0-9]+}/sessions", ApiUserRequired(getSessions)).Methods("GET") sr.Handle("/{id:[A-Za-z0-9]+}/sessions", ApiUserRequired(getSessions)).Methods("GET")
sr.Handle("/{id:[A-Za-z0-9]+}/audits", ApiUserRequired(getAudits)).Methods("GET") sr.Handle("/{id:[A-Za-z0-9]+}/audits", ApiUserRequired(getAudits)).Methods("GET")
@@ -166,6 +167,19 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User {
if team.Email == user.Email { if team.Email == user.Email {
user.Roles = model.ROLE_TEAM_ADMIN user.Roles = model.ROLE_TEAM_ADMIN
channelRole = model.CHANNEL_ROLE_ADMIN channelRole = model.CHANNEL_ROLE_ADMIN
// Below is a speical case where the first user in the entire
// system is granted the system_admin role instead of admin
if result := <-Srv.Store.User().GetTotalUsersCount(); result.Err != nil {
c.Err = result.Err
return nil
} else {
count := result.Data.(int64)
if count <= 0 {
user.Roles = model.ROLE_SYSTEM_ADMIN
}
}
} else { } else {
user.Roles = "" user.Roles = ""
} }
@@ -184,7 +198,7 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User {
l4g.Error("Encountered an issue joining default channels user_id=%s, team_id=%s, err=%v", ruser.Id, ruser.TeamId, err) l4g.Error("Encountered an issue joining default channels user_id=%s, team_id=%s, err=%v", ruser.Id, ruser.TeamId, err)
} }
//fireAndForgetWelcomeEmail(ruser.FirstName, ruser.Email, team.Name, c.TeamURL+"/channels/town-square") fireAndForgetWelcomeEmail(ruser.Email, team.DisplayName, c.GetTeamURLFromTeam(team))
if user.EmailVerified { if user.EmailVerified {
if cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil { if cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil {
l4g.Error("Failed to set email verified err=%v", cresult.Err) l4g.Error("Failed to set email verified err=%v", cresult.Err)
@@ -204,17 +218,13 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User {
} }
} }
func fireAndForgetWelcomeEmail(name, email, teamDisplayName, link, siteURL string) { func fireAndForgetWelcomeEmail(email, teamDisplayName, teamURL string) {
go func() { go func() {
subjectPage := NewServerTemplatePage("welcome_subject") subjectPage := NewServerTemplatePage("welcome_subject")
subjectPage.Props["SiteURL"] = siteURL subjectPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage := NewServerTemplatePage("welcome_body") bodyPage := NewServerTemplatePage("welcome_body")
bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["TeamURL"] = teamURL
bodyPage.Props["Nickname"] = name
bodyPage.Props["TeamDisplayName"] = teamDisplayName
bodyPage.Props["FeedbackName"] = utils.Cfg.EmailSettings.FeedbackName
bodyPage.Props["TeamURL"] = link
if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil { if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
l4g.Error("Failed to send welcome email successfully err=%v", err) l4g.Error("Failed to send welcome email successfully err=%v", err)
@@ -550,13 +560,26 @@ func getUser(c *Context, w http.ResponseWriter, r *http.Request) {
} }
func getProfiles(c *Context, w http.ResponseWriter, r *http.Request) { func getProfiles(c *Context, w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
id, ok := params["id"]
if ok {
// You must be system admin to access another team
if id != c.Session.TeamId {
if !c.HasSystemAdminPermissions("getProfiles") {
return
}
}
etag := (<-Srv.Store.User().GetEtagForProfiles(c.Session.TeamId)).Data.(string) } else {
id = c.Session.TeamId
}
etag := (<-Srv.Store.User().GetEtagForProfiles(id)).Data.(string)
if HandleEtag(etag, w, r) { if HandleEtag(etag, w, r) {
return return
} }
if result := <-Srv.Store.User().GetProfiles(c.Session.TeamId); result.Err != nil { if result := <-Srv.Store.User().GetProfiles(id); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
@@ -794,6 +817,9 @@ func uploadProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
Srv.Store.User().UpdateLastPictureUpdate(c.Session.UserId) Srv.Store.User().UpdateLastPictureUpdate(c.Session.UserId)
c.LogAudit("") c.LogAudit("")
// write something as the response since jQuery expects a json response
w.Write([]byte("true"))
} }
func updateUser(c *Context, w http.ResponseWriter, r *http.Request) { func updateUser(c *Context, w http.ResponseWriter, r *http.Request) {
@@ -924,8 +950,8 @@ func updateRoles(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if model.IsInRole(new_roles, model.ROLE_SYSTEM_ADMIN) { if model.IsInRole(new_roles, model.ROLE_SYSTEM_ADMIN) && !c.IsSystemAdmin() {
c.Err = model.NewAppError("updateRoles", "The system_admin role can only be set from the command line", "") c.Err = model.NewAppError("updateRoles", "The system_admin role can only be set by another system admin", "")
c.Err.StatusCode = http.StatusForbidden c.Err.StatusCode = http.StatusForbidden
return return
} }
@@ -1155,32 +1181,38 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
hash := props["hash"]
if len(hash) == 0 {
c.SetInvalidParam("resetPassword", "hash")
return
}
data := model.MapFromJson(strings.NewReader(props["data"]))
userId := data["user_id"]
if len(userId) != 26 {
c.SetInvalidParam("resetPassword", "data:user_id")
return
}
timeStr := data["time"]
if len(timeStr) == 0 {
c.SetInvalidParam("resetPassword", "data:time")
return
}
name := props["name"] name := props["name"]
if len(name) == 0 { if len(name) == 0 {
c.SetInvalidParam("resetPassword", "name") c.SetInvalidParam("resetPassword", "name")
return return
} }
userId := props["user_id"]
hash := props["hash"]
timeStr := ""
if !c.IsSystemAdmin() {
if len(hash) == 0 {
c.SetInvalidParam("resetPassword", "hash")
return
}
data := model.MapFromJson(strings.NewReader(props["data"]))
userId = data["user_id"]
timeStr = data["time"]
if len(timeStr) == 0 {
c.SetInvalidParam("resetPassword", "data:time")
return
}
}
if len(userId) != 26 {
c.SetInvalidParam("resetPassword", "user_id")
return
}
c.LogAuditWithUserId(userId, "attempt") c.LogAuditWithUserId(userId, "attempt")
var team *model.Team var team *model.Team
@@ -1205,15 +1237,17 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", props["data"], utils.Cfg.EmailSettings.PasswordResetSalt)) { if !c.IsSystemAdmin() {
c.Err = model.NewAppError("resetPassword", "The reset password link does not appear to be valid", "") if !model.ComparePassword(hash, fmt.Sprintf("%v:%v", props["data"], utils.Cfg.EmailSettings.PasswordResetSalt)) {
return c.Err = model.NewAppError("resetPassword", "The reset password link does not appear to be valid", "")
} return
}
t, err := strconv.ParseInt(timeStr, 10, 64) t, err := strconv.ParseInt(timeStr, 10, 64)
if err != nil || model.GetMillis()-t > 1000*60*60 { // one hour if err != nil || model.GetMillis()-t > 1000*60*60 { // one hour
c.Err = model.NewAppError("resetPassword", "The reset link has expired", "") c.Err = model.NewAppError("resetPassword", "The reset link has expired", "")
return return
}
} }
if result := <-Srv.Store.User().UpdatePassword(userId, model.HashPassword(newPassword)); result.Err != nil { if result := <-Srv.Store.User().UpdatePassword(userId, model.HashPassword(newPassword)); result.Err != nil {

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

@@ -228,6 +228,13 @@ func TestGetUser(t *testing.T) {
ruser2, _ := Client.CreateUser(&user2, "") ruser2, _ := Client.CreateUser(&user2, "")
store.Must(Srv.Store.User().VerifyEmail(ruser2.Data.(*model.User).Id)) store.Must(Srv.Store.User().VerifyEmail(ruser2.Data.(*model.User).Id))
team2 := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
rteam2, _ := Client.CreateTeam(&team2)
user3 := model.User{TeamId: rteam2.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
ruser3, _ := Client.CreateUser(&user3, "")
store.Must(Srv.Store.User().VerifyEmail(ruser3.Data.(*model.User).Id))
Client.LoginByEmail(team.Name, user.Email, user.Password) Client.LoginByEmail(team.Name, user.Email, user.Password)
rId := ruser.Data.(*model.User).Id rId := ruser.Data.(*model.User).Id
@@ -276,13 +283,27 @@ func TestGetUser(t *testing.T) {
t.Log(cache_result.Data) t.Log(cache_result.Data)
t.Fatal("cache should be empty") t.Fatal("cache should be empty")
} }
}
if _, err := Client.GetProfiles(rteam2.Data.(*model.Team).Id, ""); err == nil {
t.Fatal("shouldn't have access")
} }
Client.AuthToken = "" Client.AuthToken = ""
if _, err := Client.GetUser(ruser2.Data.(*model.User).Id, ""); err == nil { if _, err := Client.GetUser(ruser2.Data.(*model.User).Id, ""); err == nil {
t.Fatal("shouldn't have accss") t.Fatal("shouldn't have accss")
} }
c := &Context{}
c.RequestId = model.NewId()
c.IpAddress = "cmd_line"
UpdateRoles(c, ruser.Data.(*model.User), model.ROLE_SYSTEM_ADMIN)
Client.LoginByEmail(team.Name, user.Email, "pwd")
if _, err := Client.GetProfiles(rteam2.Data.(*model.Team).Id, ""); err != nil {
t.Fatal(err)
}
} }
func TestGetAudits(t *testing.T) { func TestGetAudits(t *testing.T) {

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

@@ -11,7 +11,6 @@
"TeamSettings": { "TeamSettings": {
"SiteName": "Mattermost", "SiteName": "Mattermost",
"MaxUsersPerTeam": 50, "MaxUsersPerTeam": 50,
"DefaultThemeColor": "#2389D7",
"EnableTeamCreation": true, "EnableTeamCreation": true,
"EnableUserCreation": true, "EnableUserCreation": true,
"RestrictCreationToDomains": "" "RestrictCreationToDomains": ""

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

@@ -23,3 +23,7 @@
- [Code Contribution Guidelines](developer/code-contribution.md) - [Code Contribution Guidelines](developer/code-contribution.md)
- [Developer Machine Setup](install/dev-setup.md) - [Developer Machine Setup](install/dev-setup.md)
- [Mattermost Style Guide](developer/style-guide.md) - [Mattermost Style Guide](developer/style-guide.md)
## End User Help
- [Mattermost Markdown Formatting](help/enduser/markdown.md)

152
doc/help/enduser/markdown.md Обычный файл
Просмотреть файл

@@ -0,0 +1,152 @@
# Markdown Help
Markdown makes it easy to format messages. Type a message as you normally would, and use these rules to render it with special formatting.
## Text Style:
You can use either `_` or `*` around a word to make it italic. Use two to make it bold.
* `_italics_` renders as _italics_
* `**bold**` renders as **bold**
* `**_bold-italic_**` renders as **_bold-italics_**
* `~~strikethrough~~` renders as ~~strikethrough~~
## Code:
Create a code block by indenting four spaces, or by placing ``` on the line above and below your code.
Example:
```
code block
```
Renders as:
```
code block
```
Create in-line monospaced font by surrounding it with back spaces.
```
`monospace`
```
Renders as: `monospace`.
## Links:
Create labeled links by putting the desired text in square brackets and the associated link in normal brackets.
`[Check out Mattermost!](www.mattermost.com)`
Renders as: [Check out Mattermost!](www.mattermost.com)
## In-line Images
Create in-line images using an `!` followed by the alt text in square brackets and the link in normal brackets. Add hover text by placing it in quotes after the link.
```
![alt text](link "hover text")
and
[![Build Status](https://travis-ci.org/mattermost/platform.svg?branch=master)](https://travis-ci.org/mattermost/platform) [![Github](https://assets-cdn.github.com/favicon.ico)](https://github.com/mattermost/platform)
```
Renders as:
![alt text](link "hover text")
and
[![Build Status](https://travis-ci.org/mattermost/platform.svg?branch=master)](https://travis-ci.org/mattermost/platform) [![Github](https://assets-cdn.github.com/favicon.ico)](https://github.com/mattermost/platform)
## Emojis
Check out a full list of emojis [here](http://www.emoji-cheat-sheet.com/).
```
:smile: :+1: :sheep:
```
Renders as:
:smile: :+1: :sheep:
## Lines:
Create a line by using three `*`, `_`, or `-`.
`***` renders as:
***
## Block quotes:
Create block quotes using `>`.
`> block quotes` renders as:
> block quotes
## Lists:
Create a list by using `*` or `-` as bullets. Indent a bullet point by adding two spaces in front of it.
```
* list item one
* list item two
* item two sub-point
```
Renders as:
* list item one
* list item two
* item two sub-point
Make it an ordered list by using numbers instead:
```
1. Item one
2. Item two
```
Renders as:
1. Item one
2. Item two
## Tables:
Create a table by placing a dashed line under the header row and separating the columns with a pipe `|`. (The columns dont need to line up exactly for it to work). Choose how to align table columns by including colons `:` within the header row.
```
| Left-Aligned  | Center Aligned  | Right Aligned |
| :------------ |:---------------:| -----:|
| Left column 1 | this text       |  $100 |
| Left column 2 | is              |   $10 |
| Left column 3 | centered        |    $1 |
```
Renders as:
| Left-Aligned  | Center Aligned  | Right Aligned |
| :------------ |:---------------:| -----:|
| Left column 1 | this text       |  $100 |
| Left column 2 | is              |   $10 |
| Left column 3 | centered        |    $1 |
## Headings:
Make a heading by typing # and a space before your title. For smaller headings, use more #s.
```
# Large heading
## Smaller heading
### Even smaller heading
```
Renders as:
# Large Heading
## Smaller Heading
### Even smaller heading
Alternatively, for the large heading you can underline the text using `===`. For the smaller heading you can underline using `---`
```
Large Heading
=============
Smaller Heading
--------------
```
Renders as:
Large Heading
=============
Smaller Heading
--------------

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

@@ -4,11 +4,11 @@ The following install instructions are for single-container installs of Mattermo
### Mac OSX ### ### Mac OSX ###
1. Install Boot2Docker using instructions at: http://docs.docker.com/installation/mac/ 1. Install Docker Toolbox using instructions at: http://docs.docker.com/installation/mac/
1. Start Boot2Docker from the command line and run: `boot2docker init eval “$(boot2docker shellinit)”` 1. Start Docker Toolbox from the command line and run: `docker-machine create -d virtualbox dev”`
2. Get your Docker IP address with: `boot2docker ip` 2. Get your Docker IP address with: `docker-machine ip dev`
3. Use `sudo nano /etc/hosts` to add `<Docker IP> dockerhost` to your /etc/hosts file 3. Use `sudo nano /etc/hosts` to add `<Docker IP> dockerhost` to your /etc/hosts file
4. Run: `boot2docker shellinit` and copy the export statements to your ~/.bash\_profile by running `sudo nano ~/.bash_profile`. Then run: `source ~/.bash_profile` 4. Run: `docker-machine env dev` and copy the export statements to your ~/.bash\_profile by running `sudo nano ~/.bash_profile`. Then run: `source ~/.bash_profile`
5. Run: `docker run --name mattermost-dev -d --publish 8065:80 mattermost/platform` 5. Run: `docker run --name mattermost-dev -d --publish 8065:80 mattermost/platform`
6. When docker is done fetching the image, open http://dockerhost:8065/ in your browser. 6. When docker is done fetching the image, open http://dockerhost:8065/ in your browser.

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

@@ -11,7 +11,6 @@
"TeamSettings": { "TeamSettings": {
"SiteName": "Mattermost", "SiteName": "Mattermost",
"MaxUsersPerTeam": 50, "MaxUsersPerTeam": 50,
"DefaultThemeColor": "#2389D7",
"EnableTeamCreation": true, "EnableTeamCreation": true,
"EnableUserCreation": true, "EnableUserCreation": true,
"RestrictCreationToDomains": "" "RestrictCreationToDomains": ""

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

@@ -11,7 +11,6 @@
"TeamSettings": { "TeamSettings": {
"SiteName": "Mattermost", "SiteName": "Mattermost",
"MaxUsersPerTeam": 50, "MaxUsersPerTeam": 50,
"DefaultThemeColor": "#2389D7",
"EnableTeamCreation": true, "EnableTeamCreation": true,
"EnableUserCreation": true, "EnableUserCreation": true,
"RestrictCreationToDomains": "" "RestrictCreationToDomains": ""

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

@@ -325,10 +325,10 @@ Usage:
-role="admin" The role used in other commands -role="admin" The role used in other commands
valid values are valid values are
"" - The empty role is basic user "" - The empty role is basic user
permissions permissions
"admin" - Represents a team admin and "admin" - Represents a team admin and
is used to help adminsiter one team. is used to help administer one team.
"system_admin" - Represents a system "system_admin" - Represents a system
admin who has access to all teams admin who has access to all teams
and configuration settings. This and configuration settings. This

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

@@ -150,6 +150,16 @@ func (c *Client) CreateTeam(team *Team) (*Result, *AppError) {
} }
} }
func (c *Client) GetAllTeams() (*Result, *AppError) {
if r, err := c.DoApiGet("/teams/all", "", ""); err != nil {
return nil, err
} else {
return &Result{r.Header.Get(HEADER_REQUEST_ID),
r.Header.Get(HEADER_ETAG_SERVER), TeamMapFromJson(r.Body)}, nil
}
}
func (c *Client) FindTeamByName(name string, allServers bool) (*Result, *AppError) { func (c *Client) FindTeamByName(name string, allServers bool) (*Result, *AppError) {
m := make(map[string]string) m := make(map[string]string)
m["name"] = name m["name"] = name
@@ -208,15 +218,6 @@ func (c *Client) UpdateTeamDisplayName(data map[string]string) (*Result, *AppErr
} }
} }
func (c *Client) UpdateValetFeature(data map[string]string) (*Result, *AppError) {
if r, err := c.DoApiPost("/teams/update_valet_feature", MapToJson(data)); 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) CreateUser(user *User, hash string) (*Result, *AppError) { func (c *Client) CreateUser(user *User, hash string) (*Result, *AppError) {
if r, err := c.DoApiPost("/users/create", user.ToJson()); err != nil { if r, err := c.DoApiPost("/users/create", user.ToJson()); err != nil {
return nil, err return nil, err
@@ -254,7 +255,7 @@ func (c *Client) GetMe(etag string) (*Result, *AppError) {
} }
func (c *Client) GetProfiles(teamId string, etag string) (*Result, *AppError) { func (c *Client) GetProfiles(teamId string, etag string) (*Result, *AppError) {
if r, err := c.DoApiGet("/users/profiles", "", etag); err != nil { if r, err := c.DoApiGet("/users/profiles/"+teamId, "", etag); err != nil {
return nil, err return nil, err
} else { } else {
return &Result{r.Header.Get(HEADER_REQUEST_ID), return &Result{r.Header.Get(HEADER_REQUEST_ID),
@@ -570,15 +571,6 @@ func (c *Client) CreatePost(post *Post) (*Result, *AppError) {
} }
} }
func (c *Client) CreateValetPost(post *Post) (*Result, *AppError) {
if r, err := c.DoApiPost("/channels/"+post.ChannelId+"/valet_create", post.ToJson()); err != nil {
return nil, err
} else {
return &Result{r.Header.Get(HEADER_REQUEST_ID),
r.Header.Get(HEADER_ETAG_SERVER), PostFromJson(r.Body)}, nil
}
}
func (c *Client) UpdatePost(post *Post) (*Result, *AppError) { func (c *Client) UpdatePost(post *Post) (*Result, *AppError) {
if r, err := c.DoApiPost("/channels/"+post.ChannelId+"/update", post.ToJson()); err != nil { if r, err := c.DoApiPost("/channels/"+post.ChannelId+"/update", post.ToJson()); err != nil {
return nil, err return nil, err

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

@@ -112,7 +112,6 @@ type PrivacySettings struct {
type TeamSettings struct { type TeamSettings struct {
SiteName string SiteName string
MaxUsersPerTeam int MaxUsersPerTeam int
DefaultThemeColor string
EnableTeamCreation bool EnableTeamCreation bool
EnableUserCreation bool EnableUserCreation bool
RestrictCreationToDomains string RestrictCreationToDomains string

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

@@ -73,6 +73,26 @@ func TeamFromJson(data io.Reader) *Team {
} }
} }
func TeamMapToJson(u map[string]*Team) string {
b, err := json.Marshal(u)
if err != nil {
return ""
} else {
return string(b)
}
}
func TeamMapFromJson(data io.Reader) map[string]*Team {
decoder := json.NewDecoder(data)
var teams map[string]*Team
err := decoder.Decode(&teams)
if err == nil {
return teams
} else {
return nil
}
}
func (o *Team) Etag() string { func (o *Team) Etag() string {
return Etag(o.Id, o.UpdateAt) return Etag(o.Id, o.UpdateAt)
} }

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

@@ -23,7 +23,6 @@ const (
USER_NOTIFY_ALL = "all" USER_NOTIFY_ALL = "all"
USER_NOTIFY_MENTION = "mention" USER_NOTIFY_MENTION = "mention"
USER_NOTIFY_NONE = "none" USER_NOTIFY_NONE = "none"
BOT_USERNAME = "valet"
) )
type User struct { type User struct {

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

@@ -140,6 +140,24 @@ func (me SqlSessionStore) Remove(sessionIdOrToken string) StoreChannel {
return storeChannel return storeChannel
} }
func (me SqlSessionStore) RemoveAllSessionsForTeam(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
result := StoreResult{}
_, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId})
if err != nil {
result.Err = model.NewAppError("SqlSessionStore.RemoveAllSessionsForTeam", "We couldn't remove all the sessions for the team", "id="+teamId+", err="+err.Error())
}
storeChannel <- result
close(storeChannel)
}()
return storeChannel
}
func (me SqlSessionStore) CleanUpExpiredSessions(userId string) StoreChannel { func (me SqlSessionStore) CleanUpExpiredSessions(userId string) StoreChannel {
storeChannel := make(StoreChannel) storeChannel := make(StoreChannel)

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

@@ -80,6 +80,29 @@ func TestSessionRemove(t *testing.T) {
} }
} }
func TestSessionRemoveAll(t *testing.T) {
Setup()
s1 := model.Session{}
s1.UserId = model.NewId()
s1.TeamId = model.NewId()
Must(store.Session().Save(&s1))
if rs1 := (<-store.Session().Get(s1.Id)); rs1.Err != nil {
t.Fatal(rs1.Err)
} else {
if rs1.Data.(*model.Session).Id != s1.Id {
t.Fatal("should match")
}
}
Must(store.Session().RemoveAllSessionsForTeam(s1.TeamId))
if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil {
t.Fatal("should have been removed")
}
}
func TestSessionRemoveToken(t *testing.T) { func TestSessionRemoveToken(t *testing.T) {
Setup() Setup()

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

@@ -196,7 +196,7 @@ func (s SqlTeamStore) GetTeamsForEmail(email string) StoreChannel {
return storeChannel return storeChannel
} }
func (s SqlTeamStore) GetForExport() StoreChannel { func (s SqlTeamStore) GetAll() StoreChannel {
storeChannel := make(StoreChannel) storeChannel := make(StoreChannel)
go func() { go func() {
@@ -204,7 +204,7 @@ func (s SqlTeamStore) GetForExport() StoreChannel {
var data []*model.Team var data []*model.Team
if _, err := s.GetReplica().Select(&data, "SELECT * FROM Teams"); err != nil { if _, err := s.GetReplica().Select(&data, "SELECT * FROM Teams"); err != nil {
result.Err = model.NewAppError("SqlTeamStore.GetForExport", "We could not get all teams", err.Error()) result.Err = model.NewAppError("SqlTeamStore.GetAllTeams", "We could not get all teams", err.Error())
} }
result.Data = data result.Data = data

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

@@ -481,3 +481,22 @@ func (us SqlUserStore) GetForExport(teamId string) StoreChannel {
return storeChannel return storeChannel
} }
func (us SqlUserStore) GetTotalUsersCount() StoreChannel {
storeChannel := make(StoreChannel)
go func() {
result := StoreResult{}
if count, err := us.GetReplica().SelectInt("SELECT COUNT(Id) FROM Users"); err != nil {
result.Err = model.NewAppError("SqlUserStore.GetTotalUsersCount", "We could not count the users", err.Error())
} else {
result.Data = count
}
storeChannel <- result
close(storeChannel)
}()
return storeChannel
}

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

@@ -206,6 +206,24 @@ func TestUserStoreGet(t *testing.T) {
} }
} }
func TestUserCountt(t *testing.T) {
Setup()
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
Must(store.User().Save(&u1))
if result := <-store.User().GetTotalUsersCount(); result.Err != nil {
t.Fatal(result.Err)
} else {
count := result.Data.(int64)
if count <= 0 {
t.Fatal()
}
}
}
func TestUserStoreGetProfiles(t *testing.T) { func TestUserStoreGetProfiles(t *testing.T) {
Setup() Setup()

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

@@ -47,7 +47,7 @@ type TeamStore interface {
Get(id string) StoreChannel Get(id string) StoreChannel
GetByName(name string) StoreChannel GetByName(name string) StoreChannel
GetTeamsForEmail(domain string) StoreChannel GetTeamsForEmail(domain string) StoreChannel
GetForExport() StoreChannel GetAll() StoreChannel
} }
type ChannelStore interface { type ChannelStore interface {
@@ -103,6 +103,7 @@ type UserStore interface {
GetEtagForProfiles(teamId string) StoreChannel GetEtagForProfiles(teamId string) StoreChannel
UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel
GetForExport(teamId string) StoreChannel GetForExport(teamId string) StoreChannel
GetTotalUsersCount() StoreChannel
} }
type SessionStore interface { type SessionStore interface {
@@ -110,6 +111,7 @@ type SessionStore interface {
Get(sessionIdOrToken string) StoreChannel Get(sessionIdOrToken string) StoreChannel
GetSessions(userId string) StoreChannel GetSessions(userId string) StoreChannel
Remove(sessionIdOrToken string) StoreChannel Remove(sessionIdOrToken string) StoreChannel
RemoveAllSessionsForTeam(teamId string) StoreChannel
UpdateLastActivityAt(sessionId string, time int64) StoreChannel UpdateLastActivityAt(sessionId string, time int64) StoreChannel
UpdateRoles(userId string, roles string) StoreChannel UpdateRoles(userId string, roles string) StoreChannel
} }

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

@@ -25,7 +25,8 @@ export default class ActivityLogModal extends React.Component {
clientError: null clientError: null
}; };
} }
submitRevoke(altId) { submitRevoke(altId, e) {
e.preventDefault();
Client.revokeSession(altId, Client.revokeSession(altId,
function handleRevokeSuccess() { function handleRevokeSuccess() {
AsyncClient.getSessions(); AsyncClient.getSessions();
@@ -86,7 +87,7 @@ export default class ActivityLogModal extends React.Component {
<div>{`First time active: ${firstAccessTime.toDateString()}, ${lastAccessTime.toLocaleTimeString()}`}</div> <div>{`First time active: ${firstAccessTime.toDateString()}, ${lastAccessTime.toLocaleTimeString()}`}</div>
<div>{`OS: ${currentSession.props.os}`}</div> <div>{`OS: ${currentSession.props.os}`}</div>
<div>{`Browser: ${currentSession.props.browser}`}</div> <div>{`Browser: ${currentSession.props.browser}`}</div>
<div>{`Session ID: ${currentSession.alt_id}`}</div> <div>{`Session ID: ${currentSession.id}`}</div>
</div> </div>
); );
} else { } else {
@@ -115,7 +116,7 @@ export default class ActivityLogModal extends React.Component {
</div> </div>
<div className='activity-log__action'> <div className='activity-log__action'>
<button <button
onClick={this.submitRevoke.bind(this, currentSession.alt_id)} onClick={this.submitRevoke.bind(this, currentSession.id)}
className='btn btn-primary' className='btn btn-primary'
> >
Logout Logout

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

@@ -3,6 +3,7 @@
var AdminSidebar = require('./admin_sidebar.jsx'); var AdminSidebar = require('./admin_sidebar.jsx');
var AdminStore = require('../../stores/admin_store.jsx'); var AdminStore = require('../../stores/admin_store.jsx');
var TeamStore = require('../../stores/team_store.jsx');
var AsyncClient = require('../../utils/async_client.jsx'); var AsyncClient = require('../../utils/async_client.jsx');
var LoadingScreen = require('../loading_screen.jsx'); var LoadingScreen = require('../loading_screen.jsx');
@@ -16,38 +17,104 @@ var GitLabSettingsTab = require('./gitlab_settings.jsx');
var SqlSettingsTab = require('./sql_settings.jsx'); var SqlSettingsTab = require('./sql_settings.jsx');
var TeamSettingsTab = require('./team_settings.jsx'); var TeamSettingsTab = require('./team_settings.jsx');
var ServiceSettingsTab = require('./service_settings.jsx'); var ServiceSettingsTab = require('./service_settings.jsx');
var TeamUsersTab = require('./team_users.jsx');
export default class AdminController extends React.Component { export default class AdminController extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.selectTab = this.selectTab.bind(this); this.selectTab = this.selectTab.bind(this);
this.removeSelectedTeam = this.removeSelectedTeam.bind(this);
this.addSelectedTeam = this.addSelectedTeam.bind(this);
this.onConfigListenerChange = this.onConfigListenerChange.bind(this); this.onConfigListenerChange = this.onConfigListenerChange.bind(this);
this.onAllTeamsListenerChange = this.onAllTeamsListenerChange.bind(this);
var selectedTeams = AdminStore.getSelectedTeams();
if (selectedTeams == null) {
selectedTeams = {};
selectedTeams[TeamStore.getCurrentId()] = 'true';
AdminStore.saveSelectedTeams(selectedTeams);
}
this.state = { this.state = {
config: null, config: AdminStore.getConfig(),
selected: 'service_settings' teams: AdminStore.getAllTeams(),
selectedTeams,
selected: 'service_settings',
selectedTeam: null
}; };
} }
componentDidMount() { componentDidMount() {
AdminStore.addConfigChangeListener(this.onConfigListenerChange); AdminStore.addConfigChangeListener(this.onConfigListenerChange);
AsyncClient.getConfig(); AsyncClient.getConfig();
AdminStore.addAllTeamsChangeListener(this.onAllTeamsListenerChange);
AsyncClient.getAllTeams();
} }
componentWillUnmount() { componentWillUnmount() {
AdminStore.removeConfigChangeListener(this.onConfigListenerChange); AdminStore.removeConfigChangeListener(this.onConfigListenerChange);
AdminStore.removeAllTeamsChangeListener(this.onAllTeamsListenerChange);
} }
onConfigListenerChange() { onConfigListenerChange() {
this.setState({ this.setState({
config: AdminStore.getConfig(), config: AdminStore.getConfig(),
selected: this.state.selected teams: AdminStore.getAllTeams(),
selectedTeams: AdminStore.getSelectedTeams(),
selected: this.state.selected,
selectedTeam: this.state.selectedTeam
}); });
} }
selectTab(tab) { onAllTeamsListenerChange() {
this.setState({selected: tab}); this.setState({
config: AdminStore.getConfig(),
teams: AdminStore.getAllTeams(),
selectedTeams: AdminStore.getSelectedTeams(),
selected: this.state.selected,
selectedTeam: this.state.selectedTeam
});
}
selectTab(tab, teamId) {
this.setState({
config: AdminStore.getConfig(),
teams: AdminStore.getAllTeams(),
selectedTeams: AdminStore.getSelectedTeams(),
selected: tab,
selectedTeam: teamId
});
}
removeSelectedTeam(teamId) {
var selectedTeams = AdminStore.getSelectedTeams();
Reflect.deleteProperty(selectedTeams, teamId);
AdminStore.saveSelectedTeams(selectedTeams);
this.setState({
config: AdminStore.getConfig(),
teams: AdminStore.getAllTeams(),
selectedTeams: AdminStore.getSelectedTeams(),
selected: this.state.selected,
selectedTeam: this.state.selectedTeam
});
}
addSelectedTeam(teamId) {
var selectedTeams = AdminStore.getSelectedTeams();
selectedTeams[teamId] = 'true';
AdminStore.saveSelectedTeams(selectedTeams);
this.setState({
config: AdminStore.getConfig(),
teams: AdminStore.getAllTeams(),
selectedTeams: AdminStore.getSelectedTeams(),
selected: this.state.selected,
selectedTeam: this.state.selectedTeam
});
} }
render() { render() {
@@ -74,6 +141,8 @@ export default class AdminController extends React.Component {
tab = <TeamSettingsTab config={this.state.config} />; tab = <TeamSettingsTab config={this.state.config} />;
} else if (this.state.selected === 'service_settings') { } else if (this.state.selected === 'service_settings') {
tab = <ServiceSettingsTab config={this.state.config} />; tab = <ServiceSettingsTab config={this.state.config} />;
} else if (this.state.selected === 'team_users') {
tab = <TeamUsersTab team={this.state.teams[this.state.selectedTeam]} />;
} }
} }
@@ -85,7 +154,12 @@ export default class AdminController extends React.Component {
/> />
<AdminSidebar <AdminSidebar
selected={this.state.selected} selected={this.state.selected}
selectedTeam={this.state.selectedTeam}
selectTab={this.selectTab} selectTab={this.selectTab}
teams={this.state.teams}
selectedTeams={this.state.selectedTeams}
removeSelectedTeam={this.removeSelectedTeam}
addSelectedTeam={this.addSelectedTeam}
/> />
<div className='inner__wrap channel__wrap'> <div className='inner__wrap channel__wrap'>
<div className='row header'> <div className='row header'>

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

@@ -2,6 +2,7 @@
// See License.txt for license information. // See License.txt for license information.
var AdminSidebarHeader = require('./admin_sidebar_header.jsx'); var AdminSidebarHeader = require('./admin_sidebar_header.jsx');
var SelectTeamModal = require('./select_team_modal.jsx');
export default class AdminSidebar extends React.Component { export default class AdminSidebar extends React.Component {
constructor(props) { constructor(props) {
@@ -9,28 +10,121 @@ export default class AdminSidebar extends React.Component {
this.isSelected = this.isSelected.bind(this); this.isSelected = this.isSelected.bind(this);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
this.removeTeam = this.removeTeam.bind(this);
this.showTeamSelect = this.showTeamSelect.bind(this);
this.teamSelectedModal = this.teamSelectedModal.bind(this);
this.teamSelectedModalDismissed = this.teamSelectedModalDismissed.bind(this);
this.state = { this.state = {
showSelectModal: false
}; };
} }
handleClick(name, e) { handleClick(name, teamId, e) {
e.preventDefault(); e.preventDefault();
this.props.selectTab(name); this.props.selectTab(name, teamId);
} }
isSelected(name) { isSelected(name, teamId) {
if (this.props.selected === name) { if (this.props.selected === name) {
return 'active'; if (name === 'team_users') {
if (this.props.selectedTeam != null && this.props.selectedTeam === teamId) {
return 'active';
}
} else {
return 'active';
}
} }
return ''; return '';
} }
removeTeam(teamId, e) {
e.preventDefault();
Reflect.deleteProperty(this.props.selectedTeams, teamId);
this.props.removeSelectedTeam(teamId);
if (this.props.selected === 'team_users') {
if (this.props.selectedTeam != null && this.props.selectedTeam === teamId) {
this.props.selectTab('service_settings', null);
}
}
}
componentDidMount() { componentDidMount() {
} }
showTeamSelect(e) {
e.preventDefault();
this.setState({showSelectModal: true});
}
teamSelectedModal(teamId) {
this.props.selectedTeams[teamId] = 'true';
this.setState({showSelectModal: false});
this.props.addSelectedTeam(teamId);
this.forceUpdate();
}
teamSelectedModalDismissed() {
this.setState({showSelectModal: false});
}
render() { render() {
var count = '*';
var teams = 'Loading';
if (this.props.teams != null) {
count = '' + Object.keys(this.props.teams).length;
teams = [];
for (var key in this.props.selectedTeams) {
if (this.props.selectedTeams.hasOwnProperty(key)) {
var team = this.props.teams[key];
if (team != null) {
teams.push(
<ul
key={'team_' + team.id}
className='nav nav__sub-menu'
>
<li>
<a
href='#'
onClick={this.handleClick.bind(this, 'team_users', team.id)}
className={'nav__sub-menu-item ' + this.isSelected('team_users', team.id)}
>
{team.name}
<span
className='menu-icon--right menu__close'
onClick={this.removeTeam.bind(this, team.id)}
style={{cursor: 'pointer'}}
>
{'x'}
</span>
</a>
</li>
<li>
<ul className='nav nav__inner-menu'>
<li>
<a
href='#'
className={this.isSelected('team_users', team.id)}
onClick={this.handleClick.bind(this, 'team_users', team.id)}
>
{'- Users'}
</a>
</li>
</ul>
</li>
</ul>
);
}
}
}
}
return ( return (
<div className='sidebar--left sidebar--collapsable'> <div className='sidebar--left sidebar--collapsable'>
<div> <div>
@@ -38,11 +132,19 @@ export default class AdminSidebar extends React.Component {
<ul className='nav nav-pills nav-stacked'> <ul className='nav nav-pills nav-stacked'>
<li> <li>
<ul className='nav nav__sub-menu'> <ul className='nav nav__sub-menu'>
<li>
<h4>
<span className='icon fa fa-gear'></span>
<span>{'SETTINGS'}</span>
</h4>
</li>
</ul>
<ul className='nav nav__sub-menu padded'>
<li> <li>
<a <a
href='#' href='#'
className={this.isSelected('service_settings')} className={this.isSelected('service_settings')}
onClick={this.handleClick.bind(this, 'service_settings')} onClick={this.handleClick.bind(this, 'service_settings', null)}
> >
{'Service Settings'} {'Service Settings'}
</a> </a>
@@ -51,7 +153,7 @@ export default class AdminSidebar extends React.Component {
<a <a
href='#' href='#'
className={this.isSelected('team_settings')} className={this.isSelected('team_settings')}
onClick={this.handleClick.bind(this, 'team_settings')} onClick={this.handleClick.bind(this, 'team_settings', null)}
> >
{'Team Settings'} {'Team Settings'}
</a> </a>
@@ -60,7 +162,7 @@ export default class AdminSidebar extends React.Component {
<a <a
href='#' href='#'
className={this.isSelected('sql_settings')} className={this.isSelected('sql_settings')}
onClick={this.handleClick.bind(this, 'sql_settings')} onClick={this.handleClick.bind(this, 'sql_settings', null)}
> >
{'SQL Settings'} {'SQL Settings'}
</a> </a>
@@ -69,7 +171,7 @@ export default class AdminSidebar extends React.Component {
<a <a
href='#' href='#'
className={this.isSelected('email_settings')} className={this.isSelected('email_settings')}
onClick={this.handleClick.bind(this, 'email_settings')} onClick={this.handleClick.bind(this, 'email_settings', null)}
> >
{'Email Settings'} {'Email Settings'}
</a> </a>
@@ -78,7 +180,7 @@ export default class AdminSidebar extends React.Component {
<a <a
href='#' href='#'
className={this.isSelected('image_settings')} className={this.isSelected('image_settings')}
onClick={this.handleClick.bind(this, 'image_settings')} onClick={this.handleClick.bind(this, 'image_settings', null)}
> >
{'File Settings'} {'File Settings'}
</a> </a>
@@ -87,25 +189,16 @@ export default class AdminSidebar extends React.Component {
<a <a
href='#' href='#'
className={this.isSelected('log_settings')} className={this.isSelected('log_settings')}
onClick={this.handleClick.bind(this, 'log_settings')} onClick={this.handleClick.bind(this, 'log_settings', null)}
> >
{'Log Settings'} {'Log Settings'}
</a> </a>
</li> </li>
<li>
<a
href='#'
className={this.isSelected('logs')}
onClick={this.handleClick.bind(this, 'logs')}
>
{'Logs'}
</a>
</li>
<li> <li>
<a <a
href='#' href='#'
className={this.isSelected('rate_settings')} className={this.isSelected('rate_settings')}
onClick={this.handleClick.bind(this, 'rate_settings')} onClick={this.handleClick.bind(this, 'rate_settings', null)}
> >
{'Rate Limit Settings'} {'Rate Limit Settings'}
</a> </a>
@@ -114,7 +207,7 @@ export default class AdminSidebar extends React.Component {
<a <a
href='#' href='#'
className={this.isSelected('privacy_settings')} className={this.isSelected('privacy_settings')}
onClick={this.handleClick.bind(this, 'privacy_settings')} onClick={this.handleClick.bind(this, 'privacy_settings', null)}
> >
{'Privacy Settings'} {'Privacy Settings'}
</a> </a>
@@ -123,21 +216,73 @@ export default class AdminSidebar extends React.Component {
<a <a
href='#' href='#'
className={this.isSelected('gitlab_settings')} className={this.isSelected('gitlab_settings')}
onClick={this.handleClick.bind(this, 'gitlab_settings')} onClick={this.handleClick.bind(this, 'gitlab_settings', null)}
> >
{'GitLab Settings'} {'GitLab Settings'}
</a> </a>
</li> </li>
</ul> </ul>
<ul className='nav nav__sub-menu'>
<li>
<h4>
<span className='icon fa fa-gear'></span>
<span>{'TEAMS (' + count + ')'}</span>
<span className='menu-icon--right'>
<a
href='#'
onClick={this.showTeamSelect}
>
<i className='fa fa-plus'></i>
</a>
</span>
</h4>
</li>
</ul>
<ul className='nav nav__sub-menu padded'>
<li>
{teams}
</li>
</ul>
<ul className='nav nav__sub-menu'>
<li>
<h4>
<span className='icon fa fa-gear'></span>
<span>{'OTHER'}</span>
</h4>
</li>
</ul>
<ul className='nav nav__sub-menu padded'>
<li>
<a
href='#'
className={this.isSelected('logs')}
onClick={this.handleClick.bind(this, 'logs', null)}
>
{'Logs'}
</a>
</li>
</ul>
</li> </li>
</ul> </ul>
</div> </div>
<SelectTeamModal
teams={this.props.teams}
show={this.state.showSelectModal}
onModalSubmit={this.teamSelectedModal}
onModalDismissed={this.teamSelectedModalDismissed}
/>
</div> </div>
); );
} }
} }
AdminSidebar.propTypes = { AdminSidebar.propTypes = {
teams: React.PropTypes.object,
selectedTeams: React.PropTypes.object,
removeSelectedTeam: React.PropTypes.func,
addSelectedTeam: React.PropTypes.func,
selected: React.PropTypes.string, selected: React.PropTypes.string,
selectedTeam: React.PropTypes.string,
selectTab: React.PropTypes.func selectTab: React.PropTypes.func
}; };

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

@@ -211,7 +211,7 @@ export default class EmailSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Typically set to true in production. When true Mattermost will allow team creation and account signup utilizing email and password. You would set this to false if you only wanted to allow signup from a service like OAuth or LDAP.'}</p> <p className='help-text'>{'When true, Mattermost allows team creation and account signup using email and password. This value should be false only when you want to limit signup to a single-sign-on service like OAuth or LDAP.'}</p>
</div> </div>
</div> </div>
@@ -244,7 +244,7 @@ export default class EmailSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Typically set to true in production. When true Mattermost will attempt to send email notifications. Developers may set this field to false skipping sending emails for faster development.'}</p> <p className='help-text'>{'Typically set to true in production. When true, Mattermost attempts to send email notifications. Developers may set this field to false to skip email setup for faster development.'}</p>
</div> </div>
</div> </div>
@@ -279,7 +279,7 @@ export default class EmailSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Typically set to true in production. When true Mattermost will not allow a user to login without first having recieved an email with a verification link. Developers may set this field to false so skip sending verification emails for faster development.'}</p> <p className='help-text'>{'Typically set to true in production. When true, Mattermost requires email verification after account creation prior to allowing login. Developers may set this field to false so skip sending verification emails for faster development.'}</p>
</div> </div>
</div> </div>
@@ -296,12 +296,12 @@ export default class EmailSettings extends React.Component {
className='form-control' className='form-control'
id='feedbackName' id='feedbackName'
ref='feedbackName' ref='feedbackName'
placeholder='Ex: "Mattermost", "System", "John Smith"' placeholder='Ex: "Mattermost Notification", "System", "No-Reply"'
defaultValue={this.props.config.EmailSettings.FeedbackName} defaultValue={this.props.config.EmailSettings.FeedbackName}
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.sendEmailNotifications} disabled={!this.state.sendEmailNotifications}
/> />
<p className='help-text'>{'Name displayed on email account used when sending notification emails from Mattermost.'}</p> <p className='help-text'>{'Display name on email account used when sending notification emails from Mattermost.'}</p>
</div> </div>
</div> </div>
@@ -323,7 +323,7 @@ export default class EmailSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.sendEmailNotifications} disabled={!this.state.sendEmailNotifications}
/> />
<p className='help-text'>{'Email displayed on email account used when sending notification emails from Mattermost.'}</p> <p className='help-text'>{'Email address displayed on email account used when sending notification emails from Mattermost.'}</p>
</div> </div>
</div> </div>
@@ -479,7 +479,7 @@ export default class EmailSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.sendEmailNotifications} disabled={!this.state.sendEmailNotifications}
/> />
<p className='help-text'>{'32-character salt added to signing of email invites.'}</p> <p className='help-text'>{'32-character salt added to signing of email invites. Randomly generated on install. Click "Re-Generate" to create new salt.'}</p>
<div className='help-text'> <div className='help-text'>
<button <button
className='help-link' className='help-link'
@@ -510,7 +510,7 @@ export default class EmailSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.sendEmailNotifications} disabled={!this.state.sendEmailNotifications}
/> />
<p className='help-text'>{'32-character salt added to signing of password reset emails.'}</p> <p className='help-text'>{'32-character salt added to signing of password reset emails. Randomly generated on install. Click "Re-Generate" to create new salt.'}</p>
<div className='help-text'> <div className='help-text'>
<button <button
className='help-link' className='help-link'
@@ -547,4 +547,4 @@ export default class EmailSettings extends React.Component {
EmailSettings.propTypes = { EmailSettings.propTypes = {
config: React.PropTypes.object config: React.PropTypes.object
}; };

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

@@ -114,7 +114,7 @@ export default class GitLabSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'When true Mattermost will allow team creation and account signup utilizing GitLab OAuth.'}</p> <p className='help-text'>{'When true, Mattermost allows team creation and account signup using GitLab OAuth. To configure, log in to your GitLab account and go to Applications -> Profile Settings. Enter Redirect URIs "<your-mattermost-url>/login/gitlab/complete" (example: http://localhost:8065/login/gitlab/complete) and "<your-mattermost-url>/signup/gitlab/complete". Then use "Secret" and "Id" fields to complete the options below.'}</p>
</div> </div>
</div> </div>
@@ -136,7 +136,7 @@ export default class GitLabSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.Allow} disabled={!this.state.Allow}
/> />
<p className='help-text'>{'Need help text.'}</p> <p className='help-text'>{'Obtain this value via the instructions above for logging into GitLab.'}</p>
</div> </div>
</div> </div>
@@ -158,7 +158,7 @@ export default class GitLabSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.Allow} disabled={!this.state.Allow}
/> />
<p className='help-text'>{'Need help text.'}</p> <p className='help-text'>{'Obtain this value via the instructions above for logging into GitLab'}</p>
</div> </div>
</div> </div>
@@ -175,12 +175,12 @@ export default class GitLabSettings extends React.Component {
className='form-control' className='form-control'
id='Scope' id='Scope'
ref='Scope' ref='Scope'
placeholder='Ex ""' placeholder='Not currently used by GitLab. Please leave blank'
defaultValue={this.props.config.GitLabSettings.Scope} defaultValue={this.props.config.GitLabSettings.Scope}
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.Allow} disabled={!this.state.Allow}
/> />
<p className='help-text'>{'Need help text.'}</p> <p className='help-text'>{'This field is not yet used by GitLab OAuth. Other OAuth providers may use this field to specify the scope of account data from OAuth provider that is sent to Mattermost.'}</p>
</div> </div>
</div> </div>
@@ -202,7 +202,7 @@ export default class GitLabSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.Allow} disabled={!this.state.Allow}
/> />
<p className='help-text'>{'Need help text.'}</p> <p className='help-text'>{'Enter <your-gitlab-url>/oauth/authorize (example http://localhost:3000/oauth/authorize).'}</p>
</div> </div>
</div> </div>
@@ -224,7 +224,7 @@ export default class GitLabSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.Allow} disabled={!this.state.Allow}
/> />
<p className='help-text'>{'Need help text.'}</p> <p className='help-text'>{'Enter <your-gitlab-url>/oauth/token.'}</p>
</div> </div>
</div> </div>
@@ -246,7 +246,7 @@ export default class GitLabSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.Allow} disabled={!this.state.Allow}
/> />
<p className='help-text'>{'Need help text.'}</p> <p className='help-text'>{'Enter <your-gitlab-url>/api/v3/user.'}</p>
</div> </div>
</div> </div>

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

@@ -457,7 +457,7 @@ export default class FileSettings extends React.Component {
defaultValue={this.props.config.FileSettings.PublicLinkSalt} defaultValue={this.props.config.FileSettings.PublicLinkSalt}
onChange={this.handleChange} onChange={this.handleChange}
/> />
<p className='help-text'>{'32-character salt added to signing of public image links.'}</p> <p className='help-text'>{'32-character salt added to signing of public image links. Randomly generated on install. Click "Re-Generate" to create new salt.'}</p>
<div className='help-text'> <div className='help-text'>
<button <button
className='help-link' className='help-link'

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

@@ -101,7 +101,7 @@ export default class LogSettings extends React.Component {
className='control-label col-sm-4' className='control-label col-sm-4'
htmlFor='consoleEnable' htmlFor='consoleEnable'
> >
{'Log To the Console: '} {'Log To The Console: '}
</label> </label>
<div className='col-sm-8'> <div className='col-sm-8'>
<label className='radio-inline'> <label className='radio-inline'>
@@ -125,7 +125,7 @@ export default class LogSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Typically set to false in production. Developers may set this field to true to output log messages to console based on the console level option. If true then the server will output messages to the standard output stream (stdout).'}</p> <p className='help-text'>{'Typically set to false in production. Developers may set this field to true to output log messages to console based on the console level option. If true, server writes messages to the standard output stream (stdout).'}</p>
</div> </div>
</div> </div>
@@ -149,7 +149,7 @@ export default class LogSettings extends React.Component {
<option value='INFO'>{'INFO'}</option> <option value='INFO'>{'INFO'}</option>
<option value='ERROR'>{'ERROR'}</option> <option value='ERROR'>{'ERROR'}</option>
</select> </select>
<p className='help-text'>{'This setting determines the level of detail at which log events are written to the console. ERROR: Outputs only error messages. INFO: Outputs error messages and information around startup and initialization. DEBUG: Prints high detail for developers debugging issues working on debugging issues.'}</p> <p className='help-text'>{'This setting determines the level of detail at which log events are written to the console. ERROR: Outputs only error messages. INFO: Outputs error messages and information around startup and initialization. DEBUG: Prints high detail for developers working on debugging issues.'}</p>
</div> </div>
</div> </div>
@@ -181,7 +181,7 @@ export default class LogSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Typically set to true in production. When true log files are written to the file specified in file location field below.'}</p> <p className='help-text'>{'Typically set to true in production. When true, log files are written to the log file specified in file location field below.'}</p>
</div> </div>
</div> </div>
@@ -205,7 +205,7 @@ export default class LogSettings extends React.Component {
<option value='INFO'>{'INFO'}</option> <option value='INFO'>{'INFO'}</option>
<option value='ERROR'>{'ERROR'}</option> <option value='ERROR'>{'ERROR'}</option>
</select> </select>
<p className='help-text'>{'This setting determines the level of detail at which log events are written to the file. ERROR: Outputs only error messages. INFO: Outputs error messages and information around startup and initialization. DEBUG: Prints high detail for developers debugging issues working on debugging issues.'}</p> <p className='help-text'>{'This setting determines the level of detail at which log events are written to the log file. ERROR: Outputs only error messages. INFO: Outputs error messages and information around startup and initialization. DEBUG: Prints high detail for developers working on debugging issues.'}</p>
</div> </div>
</div> </div>
@@ -227,7 +227,7 @@ export default class LogSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.fileEnable} disabled={!this.state.fileEnable}
/> />
<p className='help-text'>{'File to which log files are written. If blank, will be set to ./logs/mattermost.log. Log rotation is enabled and new files may be created in the same directory.'}</p> <p className='help-text'>{'File to which log files are written. If blank, will be set to ./logs/mattermost, which writes logs to mattermost.log. Log rotation is enabled and every 10,000 lines of log information is written to new files stored in the same directory, for example mattermost.2015-09-23.001, mattermost.2015-09-23.002, and so forth.'}</p>
</div> </div>
</div> </div>

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

@@ -99,7 +99,7 @@ export default class PrivacySettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Hides email address of users from other users including team administrator.'}</p> <p className='help-text'>{'When false, hides email address of users from other users in the user interface, including team owners and team administrators. Used when system is set up for managing teams where some users choose to keep their contact information private.'}</p>
</div> </div>
</div> </div>
@@ -132,7 +132,7 @@ export default class PrivacySettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Hides full name of users from other users including team administrator.'}</p> <p className='help-text'>{'When false, hides full name of users from other users including team owner and team administrators.'}</p>
</div> </div>
</div> </div>

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

@@ -140,7 +140,7 @@ export default class RateSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'When enabled throttles rate at which APIs respond.'}</p> <p className='help-text'>{'When true, APIs are throttled at rates specified below.'}</p>
</div> </div>
</div> </div>
@@ -184,7 +184,7 @@ export default class RateSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.EnableRateLimiter} disabled={!this.state.EnableRateLimiter}
/> />
<p className='help-text'>{'Maximum number of users sessions connected to the system as determined by VaryByRemoteAddr and VaryByHeader variables.'}</p> <p className='help-text'>{'Maximum number of users sessions connected to the system as determined by "Vary By Remote Address" and "Vary By Header" settings below.'}</p>
</div> </div>
</div> </div>
@@ -193,7 +193,7 @@ export default class RateSettings extends React.Component {
className='control-label col-sm-4' className='control-label col-sm-4'
htmlFor='VaryByRemoteAddr' htmlFor='VaryByRemoteAddr'
> >
{'Limit By Remote Address: '} {'Vary By Remote Address: '}
</label> </label>
<div className='col-sm-8'> <div className='col-sm-8'>
<label className='radio-inline'> <label className='radio-inline'>
@@ -219,7 +219,7 @@ export default class RateSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Rate limit API access by IP address.'}</p> <p className='help-text'>{'When true, rate limit API access by IP address.'}</p>
</div> </div>
</div> </div>
@@ -228,7 +228,7 @@ export default class RateSettings extends React.Component {
className='control-label col-sm-4' className='control-label col-sm-4'
htmlFor='VaryByHeader' htmlFor='VaryByHeader'
> >
{'Limit By Http Header:'} {'Vary By HTTP Header:'}
</label> </label>
<div className='col-sm-8'> <div className='col-sm-8'>
<input <input
@@ -241,7 +241,7 @@ export default class RateSettings extends React.Component {
onChange={this.handleChange} onChange={this.handleChange}
disabled={!this.state.EnableRateLimiter || this.state.VaryByRemoteAddr} disabled={!this.state.EnableRateLimiter || this.state.VaryByRemoteAddr}
/> />
<p className='help-text'>{'When filled in, vary rate limiting by http header field specified (e.g. when configuring ngnix set to "X-Real-IP", when configuring AmazonELB set to "X-Forwarded-For").'}</p> <p className='help-text'>{'When filled in, vary rate limiting by HTTP header field specified (e.g. when configuring Ngnix set to "X-Real-IP", when configuring AmazonELB set to "X-Forwarded-For").'}</p>
</div> </div>
</div> </div>

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

@@ -0,0 +1,132 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
var Client = require('../../utils/client.jsx');
var Modal = ReactBootstrap.Modal;
export default class ResetPasswordModal extends React.Component {
constructor(props) {
super(props);
this.doSubmit = this.doSubmit.bind(this);
this.doCancel = this.doCancel.bind(this);
this.state = {
serverError: null
};
}
doSubmit(e) {
e.preventDefault();
var password = React.findDOMNode(this.refs.password).value;
if (!password || password.length < 5) {
this.setState({serverError: 'Please enter at least 5 characters.'});
return;
}
this.setState({serverError: null});
var data = {};
data.new_password = password;
data.name = this.props.team.name;
data.user_id = this.props.user.id;
Client.resetPassword(data,
() => {
this.props.onModalSubmit(React.findDOMNode(this.refs.password).value);
},
(err) => {
this.setState({serverError: err.message});
}
);
}
doCancel() {
this.setState({serverError: null});
this.props.onModalDismissed();
}
render() {
if (this.props.user == null) {
return <div/>;
}
let urlClass = 'input-group input-group--limit';
let serverError = null;
if (this.state.serverError) {
urlClass += ' has-error';
serverError = <div className='form-group has-error'><p className='input__help error'>{this.state.serverError}</p></div>;
}
return (
<Modal
show={this.props.show}
onHide={this.doCancel}
>
<Modal.Header closeButton={true}>
<Modal.Title>{'Reset Password'}</Modal.Title>
</Modal.Header>
<form
role='form'
className='form-horizontal'
>
<Modal.Body>
<div className='form-group'>
<div className='col-sm-10'>
<div className={urlClass}>
<span
data-toggle='tooltip'
title='New Password'
className='input-group-addon'
>
{'New Password'}
</span>
<input
type='password'
ref='password'
className='form-control'
maxLength='22'
autoFocus={true}
tabIndex='1'
/>
</div>
{serverError}
</div>
</div>
</Modal.Body>
<Modal.Footer>
<button
type='button'
className='btn btn-default'
onClick={this.doCancel}
>
{'Close'}
</button>
<button
onClick={this.doSubmit}
type='submit'
className='btn btn-primary'
tabIndex='2'
>
{'Select'}
</button>
</Modal.Footer>
</form>
</Modal>
);
}
}
ResetPasswordModal.defaultProps = {
show: false
};
ResetPasswordModal.propTypes = {
user: React.PropTypes.object,
team: React.PropTypes.object,
show: React.PropTypes.bool.isRequired,
onModalSubmit: React.PropTypes.func,
onModalDismissed: React.PropTypes.func
};

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

@@ -1,124 +1,99 @@
// 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.
export default class SelectTeam extends React.Component { var Modal = ReactBootstrap.Modal;
export default class SelectTeamModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.doSubmit = this.doSubmit.bind(this);
}; this.doCancel = this.doCancel.bind(this);
} }
doSubmit(e) {
e.preventDefault();
this.props.onModalSubmit(React.findDOMNode(this.refs.team).value);
}
doCancel() {
this.props.onModalDismissed();
}
render() { render() {
if (this.props.teams == null) {
return <div/>;
}
var options = [];
for (var key in this.props.teams) {
if (this.props.teams.hasOwnProperty(key)) {
var team = this.props.teams[key];
options.push(
<option
key={'opt_' + team.id}
value={team.id}
>
{team.name}
</option>
);
}
}
return ( return (
<div className='modal fade' <Modal
id='select-team' show={this.props.show}
tabIndex='-1' onHide={this.doCancel}
role='dialog'
aria-labelledby='teamsModalLabel'
> >
<div className='modal-dialog' <Modal.Header closeButton={true}>
role='document' <Modal.Title>{'Select Team'}</Modal.Title>
</Modal.Header>
<form
role='form'
className='form-horizontal'
> >
<div className='modal-content'> <Modal.Body>
<div className='modal-header'> <div className='form-group'>
<button <div className='col-sm-12'>
type='button' <select
className='close' ref='team'
data-dismiss='modal' size='10'
aria-label='Close' style={{width: '100%'}}
> >
<span aria-hidden='true'>&times;</span> {options}
</button> </select>
<h4 </div>
className='modal-title'
id='teamsModalLabel'
>
{'Select a team'}
</h4>
</div> </div>
<div className='modal-body'> </Modal.Body>
<table className='more-channel-table table'> <Modal.Footer>
<tbody> <button
<tr> type='button'
<td> className='btn btn-default'
<p className='more-channel-name'>{'Descartes'}</p> onClick={this.doCancel}
</td> >
<td className='td--action'> {'Close'}
<button className='btn btn-primary'>{'Join'}</button> </button>
</td> <button
</tr> onClick={this.doSubmit}
<tr> type='submit'
<td> className='btn btn-primary'
<p className='more-channel-name'>{'Grouping'}</p> tabIndex='2'
</td> >
<td className='td--action'> {'Select'}
<button className='btn btn-primary'>{'Join'}</button> </button>
</td> </Modal.Footer>
</tr> </form>
<tr> </Modal>
<td>
<p className='more-channel-name'>{'Adventure'}</p>
</td>
<td className='td--action'>
<button className='btn btn-primary'>{'Join'}</button>
</td>
</tr>
<tr>
<td>
<p className='more-channel-name'>{'Crossroads'}</p>
</td>
<td className='td--action'>
<button className='btn btn-primary'>{'Join'}</button>
</td>
</tr>
<tr>
<td>
<p className='more-channel-name'>{'Sky scraping'}</p>
</td>
<td className='td--action'>
<button className='btn btn-primary'>{'Join'}</button>
</td>
</tr>
<tr>
<td>
<p className='more-channel-name'>{'Outdoors'}</p>
</td>
<td className='td--action'>
<button className='btn btn-primary'>{'Join'}</button>
</td>
</tr>
<tr>
<td>
<p className='more-channel-name'>{'Microsoft'}</p>
</td>
<td className='td--action'>
<button className='btn btn-primary'>{'Join'}</button>
</td>
</tr>
<tr>
<td>
<p className='more-channel-name'>{'Apple'}</p>
</td>
<td className='td--action'>
<button className='btn btn-primary'>{'Join'}</button>
</td>
</tr>
</tbody>
</table>
</div>
<div className='modal-footer'>
<button
type='button'
className='btn btn-default'
data-dismiss='modal'
>
{'Close'}
</button>
</div>
</div>
</div>
</div>
); );
} }
} }
SelectTeamModal.defaultProps = {
show: false
};
SelectTeamModal.propTypes = {
teams: React.PropTypes.object,
show: React.PropTypes.bool.isRequired,
onModalSubmit: React.PropTypes.func,
onModalDismissed: React.PropTypes.func
};

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

@@ -35,7 +35,7 @@ export default class ServiceSettings extends React.Component {
config.ServiceSettings.SegmentDeveloperKey = React.findDOMNode(this.refs.SegmentDeveloperKey).value.trim(); config.ServiceSettings.SegmentDeveloperKey = React.findDOMNode(this.refs.SegmentDeveloperKey).value.trim();
config.ServiceSettings.GoogleDeveloperKey = React.findDOMNode(this.refs.GoogleDeveloperKey).value.trim(); config.ServiceSettings.GoogleDeveloperKey = React.findDOMNode(this.refs.GoogleDeveloperKey).value.trim();
config.ServiceSettings.EnableOAuthServiceProvider = React.findDOMNode(this.refs.EnableOAuthServiceProvider).checked; //config.ServiceSettings.EnableOAuthServiceProvider = React.findDOMNode(this.refs.EnableOAuthServiceProvider).checked;
config.ServiceSettings.EnableIncomingWebhooks = React.findDOMNode(this.refs.EnableIncomingWebhooks).checked; config.ServiceSettings.EnableIncomingWebhooks = React.findDOMNode(this.refs.EnableIncomingWebhooks).checked;
config.ServiceSettings.EnableTesting = React.findDOMNode(this.refs.EnableTesting).checked; config.ServiceSettings.EnableTesting = React.findDOMNode(this.refs.EnableTesting).checked;
@@ -103,7 +103,7 @@ export default class ServiceSettings extends React.Component {
defaultValue={this.props.config.ServiceSettings.ListenAddress} defaultValue={this.props.config.ServiceSettings.ListenAddress}
onChange={this.handleChange} onChange={this.handleChange}
/> />
<p className='help-text'>{'The address to bind to and listen. ":8065" will bind to all interfaces or you can choose one like "127.0.0.1:8065". Changing this will require a server restart before taking effect.'}</p> <p className='help-text'>{'The address to which to bind and listen. Entering ":8065" will bind to all interfaces or you can choose one like "127.0.0.1:8065". Changing this will require a server restart before taking effect.'}</p>
</div> </div>
</div> </div>
@@ -170,45 +170,12 @@ export default class ServiceSettings extends React.Component {
</div> </div>
</div> </div>
<div className='form-group'>
<label
className='control-label col-sm-4'
htmlFor='EnableOAuthServiceProvider'
>
{'Enable OAuth Service Provider: '}
</label>
<div className='col-sm-8'>
<label className='radio-inline'>
<input
type='radio'
name='EnableOAuthServiceProvider'
value='true'
ref='EnableOAuthServiceProvider'
defaultChecked={this.props.config.ServiceSettings.EnableOAuthServiceProvider}
onChange={this.handleChange}
/>
{'true'}
</label>
<label className='radio-inline'>
<input
type='radio'
name='EnableOAuthServiceProvider'
value='false'
defaultChecked={!this.props.config.ServiceSettings.EnableOAuthServiceProvider}
onChange={this.handleChange}
/>
{'false'}
</label>
<p className='help-text'>{'When enabled Mattermost will act as an Oauth2 Provider. Changing this will require a server restart before taking effect.'}</p>
</div>
</div>
<div className='form-group'> <div className='form-group'>
<label <label
className='control-label col-sm-4' className='control-label col-sm-4'
htmlFor='EnableIncomingWebhooks' htmlFor='EnableIncomingWebhooks'
> >
{'EnableIncomingWebhooks: '} {'Enable Incoming Webhooks: '}
</label> </label>
<div className='col-sm-8'> <div className='col-sm-8'>
<label className='radio-inline'> <label className='radio-inline'>
@@ -232,7 +199,7 @@ export default class ServiceSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'When true incomming web hooks will be allowed.'}</p> <p className='help-text'>{'When true, incoming webhooks will be allowed.'}</p>
</div> </div>
</div> </div>
@@ -265,7 +232,7 @@ export default class ServiceSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'When true slash commands like /loadtest are enabled in the add comment box. Changing this will require a server restart before taking effect. Typically used for development.'}</p> <p className='help-text'>{'(Developer Option) When true, /loadtest slash command is enabled to load test accounts and test data. Changing this will require a server restart before taking effect.'}</p>
</div> </div>
</div> </div>
@@ -291,6 +258,39 @@ export default class ServiceSettings extends React.Component {
} }
} }
// <div className='form-group'>
// <label
// className='control-label col-sm-4'
// htmlFor='EnableOAuthServiceProvider'
// >
// {'Enable OAuth Service Provider: '}
// </label>
// <div className='col-sm-8'>
// <label className='radio-inline'>
// <input
// type='radio'
// name='EnableOAuthServiceProvider'
// value='true'
// ref='EnableOAuthServiceProvider'
// defaultChecked={this.props.config.ServiceSettings.EnableOAuthServiceProvider}
// onChange={this.handleChange}
// />
// {'true'}
// </label>
// <label className='radio-inline'>
// <input
// type='radio'
// name='EnableOAuthServiceProvider'
// value='false'
// defaultChecked={!this.props.config.ServiceSettings.EnableOAuthServiceProvider}
// onChange={this.handleChange}
// />
// {'false'}
// </label>
// <p className='help-text'>{'When enabled Mattermost will act as an OAuth2 Provider. Changing this will require a server restart before taking effect.'}</p>
// </div>
// </div>
ServiceSettings.propTypes = { ServiceSettings.propTypes = {
config: React.PropTypes.object config: React.PropTypes.object
}; };

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

@@ -252,7 +252,7 @@ export default class SqlSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'Output executing SQL statements to the log. Typically used for development.'}</p> <p className='help-text'>{'(Development Mode) When true, executing SQL statements are written to the log.'}</p>
</div> </div>
</div> </div>

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

@@ -28,7 +28,6 @@ export default class TeamSettings extends React.Component {
var config = this.props.config; var config = this.props.config;
config.TeamSettings.SiteName = React.findDOMNode(this.refs.SiteName).value.trim(); config.TeamSettings.SiteName = React.findDOMNode(this.refs.SiteName).value.trim();
config.TeamSettings.DefaultThemeColor = React.findDOMNode(this.refs.DefaultThemeColor).value.trim();
config.TeamSettings.RestrictCreationToDomains = React.findDOMNode(this.refs.RestrictCreationToDomains).value.trim(); config.TeamSettings.RestrictCreationToDomains = React.findDOMNode(this.refs.RestrictCreationToDomains).value.trim();
config.TeamSettings.EnableTeamCreation = React.findDOMNode(this.refs.EnableTeamCreation).checked; config.TeamSettings.EnableTeamCreation = React.findDOMNode(this.refs.EnableTeamCreation).checked;
config.TeamSettings.EnableUserCreation = React.findDOMNode(this.refs.EnableUserCreation).checked; config.TeamSettings.EnableUserCreation = React.findDOMNode(this.refs.EnableUserCreation).checked;
@@ -118,28 +117,7 @@ export default class TeamSettings extends React.Component {
defaultValue={this.props.config.TeamSettings.MaxUsersPerTeam} defaultValue={this.props.config.TeamSettings.MaxUsersPerTeam}
onChange={this.handleChange} onChange={this.handleChange}
/> />
<p className='help-text'>{'Maximum number of users per team.'}</p> <p className='help-text'>{'Maximum total number of users per team, including both active and inactive users.'}</p>
</div>
</div>
<div className='form-group'>
<label
className='control-label col-sm-4'
htmlFor='DefaultThemeColor'
>
{'Default Theme Color:'}
</label>
<div className='col-sm-8'>
<input
type='text'
className='form-control'
id='DefaultThemeColor'
ref='DefaultThemeColor'
placeholder='Ex "#2389D7"'
defaultValue={this.props.config.TeamSettings.DefaultThemeColor}
onChange={this.handleChange}
/>
<p className='help-text'>{'Default theme color for team sites.'}</p>
</div> </div>
</div> </div>
@@ -172,7 +150,7 @@ export default class TeamSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'When false the ability to create teams is disabled. The create team button displays error when pressed.'}</p> <p className='help-text'>{'When false, the ability to create teams is disabled. The create team button displays error when pressed.'}</p>
</div> </div>
</div> </div>
@@ -205,7 +183,7 @@ export default class TeamSettings extends React.Component {
/> />
{'false'} {'false'}
</label> </label>
<p className='help-text'>{'When false the ability to create accounts is disabled. The create account button displays error when pressed.'}</p> <p className='help-text'>{'When false, the ability to create accounts is disabled. The create account button displays error when pressed.'}</p>
</div> </div>
</div> </div>

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

@@ -0,0 +1,178 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
var Client = require('../../utils/client.jsx');
var LoadingScreen = require('../loading_screen.jsx');
var UserItem = require('./user_item.jsx');
var ResetPasswordModal = require('./reset_password_modal.jsx');
export default class UserList extends React.Component {
constructor(props) {
super(props);
this.getTeamProfiles = this.getTeamProfiles.bind(this);
this.getCurrentTeamProfiles = this.getCurrentTeamProfiles.bind(this);
this.doPasswordReset = this.doPasswordReset.bind(this);
this.doPasswordResetDismiss = this.doPasswordResetDismiss.bind(this);
this.doPasswordResetSubmit = this.doPasswordResetSubmit.bind(this);
this.state = {
teamId: props.team.id,
users: null,
serverError: null,
showPasswordModal: false,
user: null
};
}
componentDidMount() {
this.getCurrentTeamProfiles();
}
getCurrentTeamProfiles() {
this.getTeamProfiles(this.props.team.id);
}
// this.setState({
// teamId: this.state.teamId,
// users: this.state.users,
// serverError: this.state.serverError,
// showPasswordModal: this.state.showPasswordModal,
// user: this.state.user
// });
getTeamProfiles(teamId) {
Client.getProfilesForTeam(
teamId,
(users) => {
var memberList = [];
for (var id in users) {
if (users.hasOwnProperty(id)) {
memberList.push(users[id]);
}
}
memberList.sort((a, b) => {
if (a.username < b.username) {
return -1;
}
if (a.username > b.username) {
return 1;
}
return 0;
});
this.setState({
teamId: this.state.teamId,
users: memberList,
serverError: this.state.serverError,
showPasswordModal: this.state.showPasswordModal,
user: this.state.user
});
},
(err) => {
this.setState({
teamId: this.state.teamId,
users: null,
serverError: err.message,
showPasswordModal: this.state.showPasswordModal,
user: this.state.user
});
}
);
}
doPasswordReset(user) {
this.setState({
teamId: this.state.teamId,
users: this.state.users,
serverError: this.state.serverError,
showPasswordModal: true,
user
});
}
doPasswordResetDismiss() {
this.state.showPasswordModal = false;
this.state.user = null;
this.setState({
teamId: this.state.teamId,
users: this.state.users,
serverError: this.state.serverError,
showPasswordModal: false,
user: null
});
}
doPasswordResetSubmit() {
this.setState({
teamId: this.state.teamId,
users: this.state.users,
serverError: this.state.serverError,
showPasswordModal: false,
user: null
});
}
componentWillReceiveProps(newProps) {
this.getTeamProfiles(newProps.team.id);
}
componentWillUnmount() {
}
render() {
var serverError = '';
if (this.state.serverError) {
serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
}
if (this.state.users == null) {
return (
<div className='wrapper--fixed'>
<h3>{'Users for ' + this.props.team.name}</h3>
{serverError}
<LoadingScreen />
</div>
);
}
var memberList = this.state.users.map((user) => {
return (
<UserItem
key={'user_' + user.id}
user={user}
refreshProfiles={this.getCurrentTeamProfiles}
doPasswordReset={this.doPasswordReset}
/>);
});
return (
<div className='wrapper--fixed'>
<h3>{'Users for ' + this.props.team.name + ' (' + this.state.users.length + ')'}</h3>
{serverError}
<form
className='form-horizontal'
role='form'
>
<div className='member-list-holder'>
{memberList}
</div>
</form>
<ResetPasswordModal
user={this.state.user}
show={this.state.showPasswordModal}
team={this.props.team}
onModalSubmit={this.doPasswordResetSubmit}
onModalDismissed={this.doPasswordResetDismiss}
/>
</div>
);
}
}
UserList.propTypes = {
team: React.PropTypes.object
};

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

@@ -0,0 +1,266 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
var Client = require('../../utils/client.jsx');
var Utils = require('../../utils/utils.jsx');
export default class UserItem extends React.Component {
constructor(props) {
super(props);
this.handleMakeMember = this.handleMakeMember.bind(this);
this.handleMakeActive = this.handleMakeActive.bind(this);
this.handleMakeNotActive = this.handleMakeNotActive.bind(this);
this.handleMakeAdmin = this.handleMakeAdmin.bind(this);
this.handleMakeSystemAdmin = this.handleMakeSystemAdmin.bind(this);
this.handleResetPassword = this.handleResetPassword.bind(this);
this.state = {};
}
handleMakeMember(e) {
e.preventDefault();
const data = {
user_id: this.props.user.id,
new_roles: ''
};
Client.updateRoles(data,
() => {
this.props.refreshProfiles();
},
(err) => {
this.setState({serverError: err.message});
}
);
}
handleMakeActive(e) {
e.preventDefault();
Client.updateActive(this.props.user.id, true,
() => {
this.props.refreshProfiles();
},
(err) => {
this.setState({serverError: err.message});
}
);
}
handleMakeNotActive(e) {
e.preventDefault();
Client.updateActive(this.props.user.id, false,
() => {
this.props.refreshProfiles();
},
(err) => {
this.setState({serverError: err.message});
}
);
}
handleMakeAdmin(e) {
e.preventDefault();
const data = {
user_id: this.props.user.id,
new_roles: 'admin'
};
Client.updateRoles(data,
() => {
this.props.refreshProfiles();
},
(err) => {
this.setState({serverError: err.message});
}
);
}
handleMakeSystemAdmin(e) {
e.preventDefault();
const data = {
user_id: this.props.user.id,
new_roles: 'system_admin'
};
Client.updateRoles(data,
() => {
this.props.refreshProfiles();
},
(err) => {
this.setState({serverError: err.message});
}
);
}
handleResetPassword(e) {
e.preventDefault();
this.props.doPasswordReset(this.props.user);
}
render() {
let serverError = null;
if (this.state.serverError) {
serverError = (
<div className='has-error'>
<label className='has-error control-label'>{this.state.serverError}</label>
</div>
);
}
const user = this.props.user;
let currentRoles = 'Member';
if (user.roles.length > 0) {
if (user.roles.indexOf('system_admin') > -1) {
currentRoles = 'System Admin';
} else {
currentRoles = user.roles.charAt(0).toUpperCase() + user.roles.slice(1);
}
}
const email = user.email;
let showMakeMember = user.roles === 'admin' || user.roles === 'system_admin';
let showMakeAdmin = user.roles === '' || user.roles === 'system_admin';
let showMakeSystemAdmin = user.roles === '' || user.roles === 'admin';
let showMakeActive = false;
let showMakeNotActive = user.roles !== 'system_admin';
if (user.delete_at > 0) {
currentRoles = 'Inactive';
currentRoles = 'Inactive';
showMakeMember = false;
showMakeAdmin = false;
showMakeSystemAdmin = false;
showMakeActive = true;
showMakeNotActive = false;
}
let makeSystemAdmin = null;
if (showMakeSystemAdmin) {
makeSystemAdmin = (
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleMakeSystemAdmin}
>
{'Make System Admin'}
</a>
</li>
);
}
let makeAdmin = null;
if (showMakeAdmin) {
makeAdmin = (
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleMakeAdmin}
>
{'Make Admin'}
</a>
</li>
);
}
let makeMember = null;
if (showMakeMember) {
makeMember = (
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleMakeMember}
>
{'Make Member'}
</a>
</li>
);
}
let makeActive = null;
if (showMakeActive) {
makeActive = (
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleMakeActive}
>
{'Make Active'}
</a>
</li>
);
}
let makeNotActive = null;
if (showMakeNotActive) {
makeNotActive = (
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleMakeNotActive}
>
{'Make Inactive'}
</a>
</li>
);
}
return (
<div className='row member-div'>
<img
className='post-profile-img pull-left'
src={`/api/v1/users/${user.id}/image?time=${user.update_at}`}
height='36'
width='36'
/>
<span className='member-name'>{Utils.getDisplayName(user)}</span>
<span className='member-email'>{email}</span>
<div className='dropdown member-drop'>
<a
href='#'
className='dropdown-toggle theme'
type='button'
id='channel_header_dropdown'
data-toggle='dropdown'
aria-expanded='true'
>
<span>{currentRoles} </span>
<span className='caret'></span>
</a>
<ul
className='dropdown-menu member-menu'
role='menu'
aria-labelledby='channel_header_dropdown'
>
{makeAdmin}
{makeMember}
{makeActive}
{makeNotActive}
{makeSystemAdmin}
<li role='presentation'>
<a
role='menuitem'
href='#'
onClick={this.handleResetPassword}
>
{'Reset Password'}
</a>
</li>
</ul>
</div>
{serverError}
</div>
);
}
}
UserItem.propTypes = {
user: React.PropTypes.object.isRequired,
refreshProfiles: React.PropTypes.func.isRequired,
doPasswordReset: React.PropTypes.func.isRequired
};

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

@@ -109,6 +109,13 @@ export default class ChannelLoader extends React.Component {
$('.modal-body').css('overflow-y', 'auto'); $('.modal-body').css('overflow-y', 'auto');
$('.modal-body').css('max-height', $(window).height() * 0.7); $('.modal-body').css('max-height', $(window).height() * 0.7);
}); });
/* Prevent backspace from navigating back a page */
$(window).on('keydown.preventBackspace', (e) => {
if (e.which === 8 && !$(e.target).is('input, textarea')) {
e.preventDefault();
}
});
} }
componentWillUnmount() { componentWillUnmount() {
clearInterval(this.intervalId); clearInterval(this.intervalId);
@@ -123,6 +130,8 @@ export default class ChannelLoader extends React.Component {
$('body').off('mouseenter mouseleave', '.post.post--comment.same--root'); $('body').off('mouseenter mouseleave', '.post.post--comment.same--root');
$('.modal').off('show.bs.modal'); $('.modal').off('show.bs.modal');
$(window).off('keydown.preventBackspace');
} }
onSocketChange(msg) { onSocketChange(msg) {
if (msg && msg.user_id && msg.user_id !== UserStore.getCurrentId()) { if (msg && msg.user_id && msg.user_id !== UserStore.getCurrentId()) {

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

@@ -163,10 +163,22 @@ export default class ChannelNotifications extends React.Component {
}.bind(this); }.bind(this);
let curChannel = ChannelStore.get(this.state.channelId); let curChannel = ChannelStore.get(this.state.channelId);
let extraInfo = (<span>These settings will override the global notification settings</span>); let extraInfo = (
<span>
These settings will override the global notification settings.
<br/>
Desktop notifications are available on Firefox, Safari, and Chrome.
</span>
);
if (curChannel && curChannel.display_name) { if (curChannel && curChannel.display_name) {
extraInfo = (<span>These settings will override the global notification settings for the <b>{curChannel.display_name}</b> channel</span>); extraInfo = (
<span>
These settings will override the global notification settings for the <b>{curChannel.display_name}</b> channel.
<br/>
Desktop notifications are available on Firefox, Safari, and Chrome.
</span>
);
} }
return ( return (

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

@@ -28,6 +28,7 @@ export default class CreateComment extends React.Component {
this.handleUploadStart = this.handleUploadStart.bind(this); this.handleUploadStart = this.handleUploadStart.bind(this);
this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this); this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this);
this.handleUploadError = this.handleUploadError.bind(this); this.handleUploadError = this.handleUploadError.bind(this);
this.handleTextDrop = this.handleTextDrop.bind(this);
this.removePreview = this.removePreview.bind(this); this.removePreview = this.removePreview.bind(this);
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
this.getFileCount = this.getFileCount.bind(this); this.getFileCount = this.getFileCount.bind(this);
@@ -42,6 +43,12 @@ export default class CreateComment extends React.Component {
submitting: false submitting: false
}; };
} }
componentDidUpdate(prevProps, prevState) {
if (prevState.uploadsInProgress < this.state.uploadsInProgress) {
$('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight);
$('.post-right__scroll').perfectScrollbar('update');
}
}
handleSubmit(e) { handleSubmit(e) {
e.preventDefault(); e.preventDefault();
@@ -178,6 +185,11 @@ export default class CreateComment extends React.Component {
this.setState({serverError: err}); this.setState({serverError: err});
} }
} }
handleTextDrop(text) {
const newText = this.state.messageText + text;
this.handleUserInput(newText);
Utils.setCaretPosition(React.findDOMNode(this.refs.textbox.refs.message), newText.length);
}
removePreview(id) { removePreview(id) {
let previews = this.state.previews; let previews = this.state.previews;
let uploadsInProgress = this.state.uploadsInProgress; let uploadsInProgress = this.state.uploadsInProgress;
@@ -264,6 +276,7 @@ export default class CreateComment extends React.Component {
onUploadStart={this.handleUploadStart} onUploadStart={this.handleUploadStart}
onFileUpload={this.handleFileUploadComplete} onFileUpload={this.handleFileUploadComplete}
onUploadError={this.handleUploadError} onUploadError={this.handleUploadError}
onTextDrop={this.handleTextDrop}
postType='comment' postType='comment'
channelId={this.props.channelId} channelId={this.props.channelId}
/> />

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

@@ -31,6 +31,7 @@ export default class CreatePost extends React.Component {
this.handleUploadStart = this.handleUploadStart.bind(this); this.handleUploadStart = this.handleUploadStart.bind(this);
this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this); this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this);
this.handleUploadError = this.handleUploadError.bind(this); this.handleUploadError = this.handleUploadError.bind(this);
this.handleTextDrop = this.handleTextDrop.bind(this);
this.removePreview = this.removePreview.bind(this); this.removePreview = this.removePreview.bind(this);
this.onChange = this.onChange.bind(this); this.onChange = this.onChange.bind(this);
this.getFileCount = this.getFileCount.bind(this); this.getFileCount = this.getFileCount.bind(this);
@@ -51,6 +52,12 @@ export default class CreatePost extends React.Component {
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if (prevState.previews.length !== this.state.previews.length) { if (prevState.previews.length !== this.state.previews.length) {
this.resizePostHolder(); this.resizePostHolder();
return;
}
if (prevState.uploadsInProgress !== this.state.uploadsInProgress) {
this.resizePostHolder();
return;
} }
} }
getCurrentDraft() { getCurrentDraft() {
@@ -78,7 +85,7 @@ export default class CreatePost extends React.Component {
return; return;
} }
let post = {}; const post = {};
post.filenames = []; post.filenames = [];
post.message = this.state.messageText; post.message = this.state.messageText;
@@ -98,20 +105,20 @@ export default class CreatePost extends React.Component {
this.state.channelId, this.state.channelId,
post.message, post.message,
false, false,
function handleCommandSuccess(data) { (data) => {
PostStore.storeDraft(data.channel_id, null); PostStore.storeDraft(data.channel_id, null);
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null}); this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
if (data.goto_location.length > 0) { if (data.goto_location.length > 0) {
window.location.href = data.goto_location; window.location.href = data.goto_location;
} }
}.bind(this), },
function handleCommandError(err) { (err) => {
let state = {}; const state = {};
state.serverError = err.message; state.serverError = err.message;
state.submitting = false; state.submitting = false;
this.setState(state); this.setState(state);
}.bind(this) }
); );
} else { } else {
post.channel_id = this.state.channelId; post.channel_id = this.state.channelId;
@@ -132,10 +139,10 @@ export default class CreatePost extends React.Component {
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null}); this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
Client.createPost(post, channel, Client.createPost(post, channel,
function handlePostSuccess(data) { (data) => {
AsyncClient.getPosts(); AsyncClient.getPosts();
let member = ChannelStore.getMember(channel.id); const member = ChannelStore.getMember(channel.id);
member.msg_count = channel.total_msg_count; member.msg_count = channel.total_msg_count;
member.last_viewed_at = Date.now(); member.last_viewed_at = Date.now();
ChannelStore.setChannelMember(member); ChannelStore.setChannelMember(member);
@@ -145,8 +152,8 @@ export default class CreatePost extends React.Component {
post: data post: data
}); });
}, },
function handlePostError(err) { (err) => {
let state = {}; const state = {};
if (err.message === 'Invalid RootId parameter') { if (err.message === 'Invalid RootId parameter') {
if ($('#post_deleted').length > 0) { if ($('#post_deleted').length > 0) {
@@ -160,7 +167,7 @@ export default class CreatePost extends React.Component {
state.submitting = false; state.submitting = false;
this.setState(state); this.setState(state);
}.bind(this) }
); );
} }
} }
@@ -178,9 +185,9 @@ export default class CreatePost extends React.Component {
} }
} }
handleUserInput(messageText) { handleUserInput(messageText) {
this.setState({messageText: messageText}); this.setState({messageText});
let draft = PostStore.getCurrentDraft(); const draft = PostStore.getCurrentDraft();
draft.message = messageText; draft.message = messageText;
PostStore.storeCurrentDraft(draft); PostStore.storeCurrentDraft(draft);
} }
@@ -190,7 +197,7 @@ export default class CreatePost extends React.Component {
$(window).trigger('resize'); $(window).trigger('resize');
} }
handleUploadStart(clientIds, channelId) { handleUploadStart(clientIds, channelId) {
let draft = PostStore.getDraft(channelId); const draft = PostStore.getDraft(channelId);
draft.uploadsInProgress = draft.uploadsInProgress.concat(clientIds); draft.uploadsInProgress = draft.uploadsInProgress.concat(clientIds);
PostStore.storeDraft(channelId, draft); PostStore.storeDraft(channelId, draft);
@@ -198,7 +205,7 @@ export default class CreatePost extends React.Component {
this.setState({uploadsInProgress: draft.uploadsInProgress}); this.setState({uploadsInProgress: draft.uploadsInProgress});
} }
handleFileUploadComplete(filenames, clientIds, channelId) { handleFileUploadComplete(filenames, clientIds, channelId) {
let draft = PostStore.getDraft(channelId); const draft = PostStore.getDraft(channelId);
// remove each finished file from uploads // remove each finished file from uploads
for (let i = 0; i < clientIds.length; i++) { for (let i = 0; i < clientIds.length; i++) {
@@ -216,7 +223,7 @@ export default class CreatePost extends React.Component {
} }
handleUploadError(err, clientId) { handleUploadError(err, clientId) {
if (clientId !== -1) { if (clientId !== -1) {
let draft = PostStore.getDraft(this.state.channelId); const draft = PostStore.getDraft(this.state.channelId);
const index = draft.uploadsInProgress.indexOf(clientId); const index = draft.uploadsInProgress.indexOf(clientId);
if (index !== -1) { if (index !== -1) {
@@ -230,9 +237,14 @@ export default class CreatePost extends React.Component {
this.setState({serverError: err}); this.setState({serverError: err});
} }
} }
handleTextDrop(text) {
const newText = this.state.messageText + text;
this.handleUserInput(newText);
Utils.setCaretPosition(React.findDOMNode(this.refs.textbox.refs.message), newText.length);
}
removePreview(id) { removePreview(id) {
let previews = this.state.previews; const previews = Object.assign([], this.state.previews);
let uploadsInProgress = this.state.uploadsInProgress; const uploadsInProgress = this.state.uploadsInProgress;
// id can either be the path of an uploaded file or the client id of an in progress upload // id can either be the path of an uploaded file or the client id of an in progress upload
let index = previews.indexOf(id); let index = previews.indexOf(id);
@@ -247,12 +259,12 @@ export default class CreatePost extends React.Component {
} }
} }
let draft = PostStore.getCurrentDraft(); const draft = PostStore.getCurrentDraft();
draft.previews = previews; draft.previews = previews;
draft.uploadsInProgress = uploadsInProgress; draft.uploadsInProgress = uploadsInProgress;
PostStore.storeCurrentDraft(draft); PostStore.storeCurrentDraft(draft);
this.setState({previews: previews, uploadsInProgress: uploadsInProgress}); this.setState({previews, uploadsInProgress});
} }
componentDidMount() { componentDidMount() {
ChannelStore.addChangeListener(this.onChange); ChannelStore.addChangeListener(this.onChange);
@@ -266,7 +278,7 @@ export default class CreatePost extends React.Component {
if (this.state.channelId !== channelId) { if (this.state.channelId !== channelId) {
const draft = this.getCurrentDraft(); const draft = this.getCurrentDraft();
this.setState({channelId: channelId, messageText: draft.messageText, initialText: draft.messageText, submitting: false, serverError: null, postError: null, previews: draft.previews, uploadsInProgress: draft.uploadsInProgress}); this.setState({channelId, messageText: draft.messageText, initialText: draft.messageText, submitting: false, serverError: null, postError: null, previews: draft.previews, uploadsInProgress: draft.uploadsInProgress});
} }
} }
getFileCount(channelId) { getFileCount(channelId) {
@@ -334,6 +346,7 @@ export default class CreatePost extends React.Component {
onUploadStart={this.handleUploadStart} onUploadStart={this.handleUploadStart}
onFileUpload={this.handleFileUploadComplete} onFileUpload={this.handleFileUploadComplete}
onUploadError={this.handleUploadError} onUploadError={this.handleUploadError}
onTextDrop={this.handleTextDrop}
postType='post' postType='post'
channelId='' channelId=''
/> />

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

@@ -4,6 +4,7 @@
const Client = require('../utils/client.jsx'); const Client = require('../utils/client.jsx');
const AsyncClient = require('../utils/async_client.jsx'); const AsyncClient = require('../utils/async_client.jsx');
const ChannelStore = require('../stores/channel_store.jsx'); const ChannelStore = require('../stores/channel_store.jsx');
var TeamStore = require('../stores/team_store.jsx');
export default class DeleteChannelModal extends React.Component { export default class DeleteChannelModal extends React.Component {
constructor(props) { constructor(props) {
@@ -24,7 +25,7 @@ export default class DeleteChannelModal extends React.Component {
Client.deleteChannel(this.state.channelId, Client.deleteChannel(this.state.channelId,
function handleDeleteSuccess() { function handleDeleteSuccess() {
AsyncClient.getChannels(true); AsyncClient.getChannels(true);
window.location.href = '/'; window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square';
}, },
function handleDeleteError(err) { function handleDeleteError(err) {
AsyncClient.dispatchError(err, 'handleDelete'); AsyncClient.dispatchError(err, 'handleDelete');

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

@@ -2,10 +2,6 @@
// See License.txt for license information. // See License.txt for license information.
var ErrorStore = require('../stores/error_store.jsx'); var ErrorStore = require('../stores/error_store.jsx');
var utils = require('../utils/utils.jsx');
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes;
export default class ErrorBar extends React.Component { export default class ErrorBar extends React.Component {
constructor() { constructor() {
@@ -13,70 +9,79 @@ export default class ErrorBar extends React.Component {
this.onErrorChange = this.onErrorChange.bind(this); this.onErrorChange = this.onErrorChange.bind(this);
this.handleClose = this.handleClose.bind(this); this.handleClose = this.handleClose.bind(this);
this.prevTimer = null;
this.state = this.getStateFromStores(); this.state = ErrorStore.getLastError();
if (this.state.message) { if (this.state && this.state.message) {
setTimeout(this.handleClose, 10000); this.prevTimer = setTimeout(this.handleClose, 10000);
} }
} }
getStateFromStores() {
var error = ErrorStore.getLastError();
if (!error || error.message === 'There appears to be a problem with your internet connection') {
return {message: null};
}
return {message: error.message};
}
componentDidMount() { componentDidMount() {
ErrorStore.addChangeListener(this.onErrorChange); ErrorStore.addChangeListener(this.onErrorChange);
$('body').css('padding-top', $(React.findDOMNode(this)).outerHeight()); $('body').css('padding-top', $(React.findDOMNode(this)).outerHeight());
$(window).resize(function onResize() { $(window).resize(() => {
if (this.state.message) { if (this.state && this.state.message) {
$('body').css('padding-top', $(React.findDOMNode(this)).outerHeight()); $('body').css('padding-top', $(React.findDOMNode(this)).outerHeight());
} }
}.bind(this)); });
} }
componentWillUnmount() { componentWillUnmount() {
ErrorStore.removeChangeListener(this.onErrorChange); ErrorStore.removeChangeListener(this.onErrorChange);
} }
onErrorChange() {
var newState = this.getStateFromStores();
if (!utils.areStatesEqual(newState, this.state)) {
if (newState.message) {
setTimeout(this.handleClose, 10000);
}
onErrorChange() {
var newState = ErrorStore.getLastError();
if (this.prevTimer != null) {
clearInterval(this.prevTimer);
this.prevTimer = null;
}
if (newState) {
this.setState(newState); this.setState(newState);
this.prevTimer = setTimeout(this.handleClose, 10000);
} else {
this.setState({message: null});
} }
} }
handleClose(e) { handleClose(e) {
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
AppDispatcher.handleServerAction({ ErrorStore.storeLastError(null);
type: ActionTypes.RECIEVED_ERROR, ErrorStore.emitChange();
err: null
});
$('body').css('padding-top', '0'); $('body').css('padding-top', '0');
} }
render() { render() {
if (this.state.message) { if (!this.state) {
return ( return <div/>;
<div className='error-bar'>
<span>{this.state.message}</span>
<a
href='#'
className='error-bar__close'
onClick={this.handleClose}
>
&times;
</a>
</div>
);
} }
return <div/>; if (!this.state.message) {
return <div/>;
}
if (this.state.connErrorCount < 7) {
return <div/>;
}
return (
<div className='error-bar'>
<span>{this.state.message}</span>
<a
href='#'
className='error-bar__close'
onClick={this.handleClose}
>
&times;
</a>
</div>
);
} }
} }

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

@@ -143,10 +143,7 @@ export default class FileAttachment extends React.Component {
> >
<a className='post-image__thumbnail' <a className='post-image__thumbnail'
href='#' href='#'
onClick={this.props.handleImageClick} onClick={() => this.props.handleImageClick(this.props.index)}
data-img-id={this.props.index}
data-toggle='modal'
data-target={'#' + this.props.modalId}
> >
{thumbnail} {thumbnail}
</a> </a>
@@ -187,9 +184,6 @@ FileAttachment.propTypes = {
// the index of this attachment preview in the parent FileAttachmentList // the index of this attachment preview in the parent FileAttachmentList
index: React.PropTypes.number.isRequired, index: React.PropTypes.number.isRequired,
// the identifier of the modal dialog used to preview files // handler for when the thumbnail is clicked passed the index above
modalId: React.PropTypes.string.isRequired,
// handler for when the thumbnail is clicked
handleImageClick: React.PropTypes.func handleImageClick: React.PropTypes.func
}; };

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

@@ -11,23 +11,21 @@ export default class FileAttachmentList extends React.Component {
this.handleImageClick = this.handleImageClick.bind(this); this.handleImageClick = this.handleImageClick.bind(this);
this.state = {startImgId: 0}; this.state = {showPreviewModal: false, startImgId: 0};
} }
handleImageClick(e) { handleImageClick(indexClicked) {
this.setState({startImgId: parseInt($(e.target.parentNode).attr('data-img-id'), 10)}); this.setState({showPreviewModal: true, startImgId: indexClicked});
} }
render() { render() {
var filenames = this.props.filenames; var filenames = this.props.filenames;
var modalId = this.props.modalId;
var postFiles = []; var postFiles = [];
for (var i = 0; i < filenames.length && i < Constants.MAX_DISPLAY_FILES; i++) { for (var i = 0; i < filenames.length && i < Constants.MAX_DISPLAY_FILES; i++) {
postFiles.push( postFiles.push(
<FileAttachment <FileAttachment
key={i} key={'file_attachment_' + i}
filename={filenames[i]} filename={filenames[i]}
index={i} index={i}
modalId={modalId}
handleImageClick={this.handleImageClick} handleImageClick={this.handleImageClick}
/> />
); );
@@ -39,9 +37,10 @@ export default class FileAttachmentList extends React.Component {
{postFiles} {postFiles}
</div> </div>
<ViewImageModal <ViewImageModal
show={this.state.showPreviewModal}
onModalDismissed={() => this.setState({showPreviewModal: false})}
channelId={this.props.channelId} channelId={this.props.channelId}
userId={this.props.userId} userId={this.props.userId}
modalId={modalId}
startId={this.state.startImgId} startId={this.state.startImgId}
filenames={filenames} filenames={filenames}
/> />
@@ -55,9 +54,6 @@ FileAttachmentList.propTypes = {
// a list of file pathes displayed by this // a list of file pathes displayed by this
filenames: React.PropTypes.arrayOf(React.PropTypes.string).isRequired, filenames: React.PropTypes.arrayOf(React.PropTypes.string).isRequired,
// the identifier of the modal dialog used to preview files
modalId: React.PropTypes.string.isRequired,
// the channel that this is part of // the channel that this is part of
channelId: React.PropTypes.string, channelId: React.PropTypes.string,

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

@@ -110,7 +110,7 @@ export default class FileUpload extends React.Component {
if (typeof files !== 'string' && files.length) { if (typeof files !== 'string' && files.length) {
this.uploadFiles(files); this.uploadFiles(files);
} else { } else {
this.props.onUploadError('Invalid file upload', -1); this.props.onTextDrop(e.originalEvent.dataTransfer.getData('Text'));
} }
} }
@@ -266,6 +266,7 @@ FileUpload.propTypes = {
getFileCount: React.PropTypes.func, getFileCount: React.PropTypes.func,
onFileUpload: React.PropTypes.func, onFileUpload: React.PropTypes.func,
onUploadStart: React.PropTypes.func, onUploadStart: React.PropTypes.func,
onTextDrop: React.PropTypes.func,
channelId: React.PropTypes.string, channelId: React.PropTypes.string,
postType: React.PropTypes.string postType: React.PropTypes.string
}; };

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

@@ -262,7 +262,7 @@ export default class Navbar extends React.Component {
return ( return (
<div className='navbar-brand'> <div className='navbar-brand'>
<a <a
href='/' href={TeamStore.getCurrentTeamUrl() + '/channels/town-square'}
className='heading' className='heading'
> >
{channelTitle} {channelTitle}

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

@@ -141,7 +141,6 @@ export default class PostBody extends React.Component {
fileAttachmentHolder = ( fileAttachmentHolder = (
<FileAttachmentList <FileAttachmentList
filenames={filenames} filenames={filenames}
modalId={`view_image_modal_${post.id}`}
channelId={post.channel_id} channelId={post.channel_id}
userId={post.user_id} userId={post.user_id}
/> />

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

@@ -5,6 +5,8 @@ var UserStore = require('../stores/user_store.jsx');
var utils = require('../utils/utils.jsx'); var utils = require('../utils/utils.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
var Tooltip = ReactBootstrap.Tooltip;
var OverlayTrigger = ReactBootstrap.OverlayTrigger;
export default class PostInfo extends React.Component { export default class PostInfo extends React.Component {
constructor(props) { constructor(props) {
@@ -148,15 +150,19 @@ export default class PostInfo extends React.Component {
var dropdown = this.createDropdown(); var dropdown = this.createDropdown();
let tooltip = <Tooltip>{utils.displayDate(post.create_at)} at ${utils.displayTime(post.create_at)}</Tooltip>;
return ( return (
<ul className='post-header post-info'> <ul className='post-header post-info'>
<li className='post-header-col'> <li className='post-header-col'>
<time <OverlayTrigger
className='post-profile-time' placement='top'
title={new Date(post.create_at).toString()} overlay={tooltip}
> >
{utils.displayDateTime(post.create_at)} <time className='post-profile-time'>
</time> {utils.displayDateTime(post.create_at)}
</time>
</OverlayTrigger>
</li> </li>
<li className='post-header-col post-header__reply'> <li className='post-header-col post-header__reply'>
<div className='dropdown'> <div className='dropdown'>

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

@@ -105,18 +105,18 @@ export default class PostList extends React.Component {
UserStore.addStatusesChangeListener(this.onTimeChange); UserStore.addStatusesChangeListener(this.onTimeChange);
SocketStore.addChangeListener(this.onSocketChange); SocketStore.addChangeListener(this.onSocketChange);
var postHolder = $(React.findDOMNode(this.refs.postlist)); const postHolder = $(React.findDOMNode(this.refs.postlist));
$(window).on('resize.' + this.props.channelId, function resize() { $(window).resize(() => {
this.resize(); this.resize();
if (!this.scrolled) { if (!this.scrolled) {
this.scrollToBottom(); this.scrollToBottom();
} }
}.bind(this)); });
postHolder.on('scroll', function scroll() { postHolder.on('scroll', () => {
var position = postHolder.scrollTop() + postHolder.height() + 14; const position = postHolder.scrollTop() + postHolder.height() + 14;
var bottom = postHolder[0].scrollHeight; const bottom = postHolder[0].scrollHeight;
if (position >= bottom) { if (position >= bottom) {
this.scrolled = false; this.scrolled = false;
@@ -128,7 +128,7 @@ export default class PostList extends React.Component {
this.userHasSeenNew = true; this.userHasSeenNew = true;
} }
this.isUserScroll = true; this.isUserScroll = true;
}.bind(this)); });
$('.post-list__content div .post').removeClass('post--last'); $('.post-list__content div .post').removeClass('post--last');
$('.post-list__content div:last-child .post').addClass('post--last'); $('.post-list__content div:last-child .post').addClass('post--last');
@@ -146,7 +146,7 @@ export default class PostList extends React.Component {
UserStore.removeStatusesChangeListener(this.onTimeChange); UserStore.removeStatusesChangeListener(this.onTimeChange);
SocketStore.removeChangeListener(this.onSocketChange); SocketStore.removeChangeListener(this.onSocketChange);
$('body').off('click.userpopover'); $('body').off('click.userpopover');
$(window).off('resize.' + this.props.channelId); $(window).off('resize');
var postHolder = $(React.findDOMNode(this.refs.postlist)); var postHolder = $(React.findDOMNode(this.refs.postlist));
postHolder.off('scroll'); postHolder.off('scroll');
} }

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

@@ -163,7 +163,6 @@ export default class RhsComment extends React.Component {
fileAttachment = ( fileAttachment = (
<FileAttachmentList <FileAttachmentList
filenames={post.filenames} filenames={post.filenames}
modalId={'rhs_comment_view_image_modal_' + post.id}
channelId={post.channel_id} channelId={post.channel_id}
userId={post.user_id} userId={post.user_id}
/> />
@@ -186,10 +185,7 @@ export default class RhsComment extends React.Component {
<strong><UserProfile userId={post.user_id} /></strong> <strong><UserProfile userId={post.user_id} /></strong>
</li> </li>
<li className='post-header-col'> <li className='post-header-col'>
<time <time className='post-profile-time'>
className='post-profile-time'
title={new Date(post.create_at).toString()}
>
{Utils.displayCommentDateTime(post.create_at)} {Utils.displayCommentDateTime(post.create_at)}
</time> </time>
</li> </li>

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

@@ -111,7 +111,6 @@ export default class RhsRootPost extends React.Component {
fileAttachment = ( fileAttachment = (
<FileAttachmentList <FileAttachmentList
filenames={post.filenames} filenames={post.filenames}
modalId={'rhs_view_image_modal_' + post.id}
channelId={post.channel_id} channelId={post.channel_id}
userId={post.user_id} userId={post.user_id}
/> />
@@ -133,10 +132,7 @@ export default class RhsRootPost extends React.Component {
<ul className='post-header'> <ul className='post-header'>
<li className='post-header-col'><strong><UserProfile userId={post.user_id} /></strong></li> <li className='post-header-col'><strong><UserProfile userId={post.user_id} /></strong></li>
<li className='post-header-col'> <li className='post-header-col'>
<time <time className='post-profile-time'>
className='post-profile-time'
title={new Date(post.create_at).toString()}
>
{utils.displayCommentDateTime(post.create_at)} {utils.displayCommentDateTime(post.create_at)}
</time> </time>
</li> </li>

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

@@ -7,7 +7,8 @@ export default class SettingsSidebar extends React.Component {
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
} }
handleClick(tab) { handleClick(tab, e) {
e.preventDefault();
this.props.updateTab(tab.name); this.props.updateTab(tab.name);
$('.settings-modal').addClass('display--content'); $('.settings-modal').addClass('display--content');
} }

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

@@ -84,7 +84,7 @@ export default class SignupUserComplete extends React.Component {
if (this.props.hash > 0) { if (this.props.hash > 0) {
BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: 'finished'})); BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: 'finished'}));
} }
window.location.href = '/'; window.location.href = '/' + this.props.teamName + '/channels/town-square';
}.bind(this), }.bind(this),
function emailLoginFailure(err) { function emailLoginFailure(err) {
if (err.message === 'Login failed because email address has not been verified') { if (err.message === 'Login failed because email address has not been verified') {

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

@@ -1,190 +0,0 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
var SettingItemMin = require('./setting_item_min.jsx');
var SettingItemMax = require('./setting_item_max.jsx');
var Client = require('../utils/client.jsx');
var AsyncClient = require('../utils/async_client.jsx');
export default class FeatureTab extends React.Component {
constructor(props) {
super(props);
this.submitValetFeature = this.submitValetFeature.bind(this);
this.handleValetRadio = this.handleValetRadio.bind(this);
this.onUpdateSection = this.onUpdateSection.bind(this);
this.setupInitialState = this.setupInitialState.bind(this);
this.state = this.setupInitialState();
}
componentWillReceiveProps(newProps) {
var team = newProps.team;
var allowValet = 'false';
if (team && team.allow_valet) {
allowValet = 'true';
}
this.setState({allowValet: allowValet});
}
submitValetFeature() {
var data = {};
data.allow_valet = this.state.allowValet;
Client.updateValetFeature(data,
function success() {
this.props.updateSection('');
AsyncClient.getMyTeam();
}.bind(this),
function fail(err) {
var state = this.setupInitialState();
state.serverError = err;
this.setState(state);
}.bind(this)
);
}
handleValetRadio(val) {
this.setState({allowValet: val});
React.findDOMNode(this.refs.wrapper).focus();
}
onUpdateSection(e) {
e.preventDefault();
if (this.props.activeSection === 'valet') {
this.props.updateSection('');
} else {
this.props.updateSection('valet');
}
}
setupInitialState() {
var allowValet;
var team = this.props.team;
if (team && team.allow_valet) {
allowValet = 'true';
} else {
allowValet = 'false';
}
return {allowValet: allowValet};
}
render() {
var clientError = null;
var serverError = null;
if (this.state.clientError) {
clientError = this.state.clientError;
}
if (this.state.serverError) {
serverError = this.state.serverError;
}
var valetSection;
if (this.props.activeSection === 'valet') {
var valetActive = [false, false];
if (this.state.allowValet === 'false') {
valetActive[1] = true;
} else {
valetActive[0] = true;
}
let inputs = [];
inputs.push(
<div key='teamValetSetting'>
<div className='radio'>
<label>
<input
type='radio'
checked={valetActive[0]}
onChange={this.handleValetRadio.bind(this, 'true')}
>
On
</input>
</label>
<br/>
</div>
<div className='radio'>
<label>
<input
type='radio'
checked={valetActive[1]}
onChange={this.handleValetRadio.bind(this, 'false')}
>
Off
</input>
</label>
<br/>
</div>
<div><br/>Valet is a preview feature for enabling a non-user account limited to basic member permissions that can be manipulated by 3rd parties.<br/><br/>IMPORTANT: The preview version of Valet should not be used without a secure connection and a trusted 3rd party, since user credentials are used to connect. OAuth2 will be used in the final release.</div>
</div>
);
valetSection = (
<SettingItemMax
title='Valet (Preview - EXPERTS ONLY)'
inputs={inputs}
submit={this.submitValetFeature}
server_error={serverError}
client_error={clientError}
updateSection={this.onUpdateSection}
/>
);
} else {
var describe = '';
if (this.state.allowValet === 'false') {
describe = 'Off';
} else {
describe = 'On';
}
valetSection = (
<SettingItemMin
title='Valet (Preview - EXPERTS ONLY)'
describe={describe}
updateSection={this.onUpdateSection}
/>
);
}
return (
<div>
<div className='modal-header'>
<button
type='button'
className='close'
data-dismiss='modal'
aria-label='Close'
>
<span aria-hidden='true'>&times;</span>
</button>
<h4
className='modal-title'
ref='title'
>
<i className='modal-back'></i>Advanced Features
</h4>
</div>
<div
ref='wrapper'
className='user-settings'
>
<h3 className='tab-header'>Advanced Features</h3>
<div className='divider-dark first'/>
{valetSection}
<div className='divider-dark'/>
</div>
</div>
);
}
}
FeatureTab.defaultProps = {
team: {},
activeSection: ''
};
FeatureTab.propTypes = {
updateSection: React.PropTypes.func.isRequired,
team: React.PropTypes.object.isRequired,
activeSection: React.PropTypes.string.isRequired
};

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

@@ -35,7 +35,7 @@ export default class TeamImportTab extends React.Component {
var uploadHelpText = ( var uploadHelpText = (
<div> <div>
<p>{'Slack does not allow you to export files, images, private groups or direct messages stored in Slack. Therefore, Slack import to Mattermost only supports importing of text messages in your Slack team\'\s public channels.'}</p> <p>{'Slack does not allow you to export files, images, private groups or direct messages stored in Slack. Therefore, Slack import to Mattermost only supports importing of text messages in your Slack team\'\s public channels.'}</p>
<p>{'The Slack import to Mattermost is in "Preview". Slack bot posts do not yet import.'}</p> <p>{'The Slack import to Mattermost is in "Preview". Slack bot posts do not yet import and Slack @mentions are not currently supported.'}</p>
</div> </div>
); );

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

@@ -4,7 +4,6 @@
var TeamStore = require('../stores/team_store.jsx'); var TeamStore = require('../stores/team_store.jsx');
var ImportTab = require('./team_import_tab.jsx'); var ImportTab = require('./team_import_tab.jsx');
var ExportTab = require('./team_export_tab.jsx'); var ExportTab = require('./team_export_tab.jsx');
var FeatureTab = require('./team_feature_tab.jsx');
var GeneralTab = require('./team_general_tab.jsx'); var GeneralTab = require('./team_general_tab.jsx');
var Utils = require('../utils/utils.jsx'); var Utils = require('../utils/utils.jsx');
@@ -25,7 +24,7 @@ export default class TeamSettings extends React.Component {
onChange() { onChange() {
var team = TeamStore.getCurrent(); var team = TeamStore.getCurrent();
if (!Utils.areStatesEqual(this.state.team, team)) { if (!Utils.areStatesEqual(this.state.team, team)) {
this.setState({team: team}); this.setState({team});
} }
} }
render() { render() {
@@ -43,17 +42,6 @@ export default class TeamSettings extends React.Component {
</div> </div>
); );
break; break;
case 'feature':
result = (
<div>
<FeatureTab
team={this.state.team}
activeSection={this.props.activeSection}
updateSection={this.props.updateSection}
/>
</div>
);
break;
case 'import': case 'import':
result = ( result = (
<div> <div>

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

@@ -20,8 +20,8 @@ export default class TeamSettingsModal extends React.Component {
$('body').on('click', '.modal-back', function handleBackClick() { $('body').on('click', '.modal-back', function handleBackClick() {
$(this).closest('.modal-dialog').removeClass('display--content'); $(this).closest('.modal-dialog').removeClass('display--content');
}); });
$('body').on('click', '.modal-header .close', function handleCloseClick() { $('body').on('click', '.modal-header .close', () => {
setTimeout(function removeContent() { setTimeout(() => {
$('.modal-dialog.display--content').removeClass('display--content'); $('.modal-dialog.display--content').removeClass('display--content');
}, 500); }, 500);
}); });
@@ -33,11 +33,12 @@ export default class TeamSettingsModal extends React.Component {
this.setState({activeSection: section}); this.setState({activeSection: section});
} }
render() { render() {
let tabs = []; const tabs = [];
tabs.push({name: 'general', uiName: 'General', icon: 'glyphicon glyphicon-cog'}); tabs.push({name: 'general', uiName: 'General', icon: 'glyphicon glyphicon-cog'});
tabs.push({name: 'import', uiName: 'Import', icon: 'glyphicon glyphicon-upload'}); tabs.push({name: 'import', uiName: 'Import', icon: 'glyphicon glyphicon-upload'});
tabs.push({name: 'export', uiName: 'Export', icon: 'glyphicon glyphicon-download'});
tabs.push({name: 'feature', uiName: 'Advanced', icon: 'glyphicon glyphicon-wrench'}); // To enable export uncomment this line
//tabs.push({name: 'export', uiName: 'Export', icon: 'glyphicon glyphicon-download'});
return ( return (
<div <div
@@ -63,7 +64,7 @@ export default class TeamSettingsModal extends React.Component {
className='modal-title' className='modal-title'
ref='title' ref='title'
> >
Team Settings {'Team Settings'}
</h4> </h4>
</div> </div>
<div className='modal-body'> <div className='modal-body'>

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

@@ -53,7 +53,7 @@ export default class TeamSignupPasswordPage extends React.Component {
props.state.wizard = 'finished'; props.state.wizard = 'finished';
props.updateParent(props.state, true); props.updateParent(props.state, true);
window.location.href = '/'; window.location.href = '/' + teamSignup.team.name + '/channels/town-square';
}.bind(this), }.bind(this),
function loginFail(err) { function loginFail(err) {
if (err.message === 'Login failed because email address has not been verified') { if (err.message === 'Login failed because email address has not been verified') {

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

@@ -42,7 +42,7 @@ export default class SSOSignUpPage extends React.Component {
if (data.follow_link) { if (data.follow_link) {
window.location.href = data.follow_link; window.location.href = data.follow_link;
} else { } else {
window.location.href = '/'; window.location.href = '/' + team.name + '/channels/town-square';
} }
}, },
function fail(err) { function fail(err) {

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

@@ -5,7 +5,6 @@ const AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
const PostStore = require('../stores/post_store.jsx'); const PostStore = require('../stores/post_store.jsx');
const CommandList = require('./command_list.jsx'); const CommandList = require('./command_list.jsx');
const ErrorStore = require('../stores/error_store.jsx'); const ErrorStore = require('../stores/error_store.jsx');
const AsyncClient = require('../utils/async_client.jsx');
const Utils = require('../utils/utils.jsx'); const Utils = require('../utils/utils.jsx');
const Constants = require('../utils/constants.jsx'); const Constants = require('../utils/constants.jsx');
@@ -18,7 +17,6 @@ export default class Textbox extends React.Component {
this.getStateFromStores = this.getStateFromStores.bind(this); this.getStateFromStores = this.getStateFromStores.bind(this);
this.onListenerChange = this.onListenerChange.bind(this); this.onListenerChange = this.onListenerChange.bind(this);
this.onRecievedError = this.onRecievedError.bind(this); this.onRecievedError = this.onRecievedError.bind(this);
this.onTimerInterrupt = this.onTimerInterrupt.bind(this);
this.updateMentionTab = this.updateMentionTab.bind(this); this.updateMentionTab = this.updateMentionTab.bind(this);
this.handleChange = this.handleChange.bind(this); this.handleChange = this.handleChange.bind(this);
this.handleKeyPress = this.handleKeyPress.bind(this); this.handleKeyPress = this.handleKeyPress.bind(this);
@@ -35,8 +33,7 @@ export default class Textbox extends React.Component {
this.state = { this.state = {
mentionText: '-1', mentionText: '-1',
mentions: [], mentions: [],
connection: '', connection: ''
timerInterrupt: null
}; };
this.caret = -1; this.caret = -1;
@@ -44,6 +41,7 @@ export default class Textbox extends React.Component {
this.doProcessMentions = false; this.doProcessMentions = false;
this.mentions = []; this.mentions = [];
} }
getStateFromStores() { getStateFromStores() {
const error = ErrorStore.getLastError(); const error = ErrorStore.getLastError();
@@ -53,6 +51,7 @@ export default class Textbox extends React.Component {
return {message: null}; return {message: null};
} }
componentDidMount() { componentDidMount() {
PostStore.addAddMentionListener(this.onListenerChange); PostStore.addAddMentionListener(this.onListenerChange);
ErrorStore.addChangeListener(this.onRecievedError); ErrorStore.addChangeListener(this.onRecievedError);
@@ -60,46 +59,28 @@ export default class Textbox extends React.Component {
this.resize(); this.resize();
this.updateMentionTab(null); this.updateMentionTab(null);
} }
componentWillUnmount() { componentWillUnmount() {
PostStore.removeAddMentionListener(this.onListenerChange); PostStore.removeAddMentionListener(this.onListenerChange);
ErrorStore.removeChangeListener(this.onRecievedError); ErrorStore.removeChangeListener(this.onRecievedError);
} }
onListenerChange(id, username) { onListenerChange(id, username) {
if (id === this.props.id) { if (id === this.props.id) {
this.addMention(username); this.addMention(username);
} }
} }
onRecievedError() { onRecievedError() {
const errorState = this.getStateFromStores(); const errorState = ErrorStore.getLastError();
if (this.state.timerInterrupt !== null) { if (errorState && errorState.connErrorCount > 0) {
window.clearInterval(this.state.timerInterrupt);
this.setState({timerInterrupt: null});
}
if (errorState.message === 'There appears to be a problem with your internet connection') {
this.setState({connection: 'bad-connection'}); this.setState({connection: 'bad-connection'});
const timerInterrupt = window.setInterval(this.onTimerInterrupt, 5000);
this.setState({timerInterrupt: timerInterrupt});
} else { } else {
this.setState({connection: ''}); this.setState({connection: ''});
} }
} }
onTimerInterrupt() {
// Since these should only happen when you have no connection and slightly briefly after any
// performance hit should not matter
if (this.state.connection === 'bad-connection') {
AppDispatcher.handleServerAction({
type: ActionTypes.RECIEVED_ERROR,
err: null
});
AsyncClient.updateLastViewedAt();
}
window.clearInterval(this.state.timerInterrupt);
this.setState({timerInterrupt: null});
}
componentDidUpdate() { componentDidUpdate() {
if (this.caret >= 0) { if (this.caret >= 0) {
Utils.setCaretPosition(React.findDOMNode(this.refs.message), this.caret); Utils.setCaretPosition(React.findDOMNode(this.refs.message), this.caret);
@@ -111,6 +92,7 @@ export default class Textbox extends React.Component {
} }
this.resize(); this.resize();
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (!this.addedMention) { if (!this.addedMention) {
this.checkForNewMention(nextProps.messageText); this.checkForNewMention(nextProps.messageText);
@@ -122,19 +104,22 @@ export default class Textbox extends React.Component {
this.addedMention = false; this.addedMention = false;
this.refs.commands.getSuggestedCommands(nextProps.messageText); this.refs.commands.getSuggestedCommands(nextProps.messageText);
} }
updateMentionTab(mentionText) { updateMentionTab(mentionText) {
// using setTimeout so dispatch isn't called during an in progress dispatch // using setTimeout so dispatch isn't called during an in progress dispatch
setTimeout(function updateMentionTabAfterTimeout() { setTimeout(() => {
AppDispatcher.handleViewAction({ AppDispatcher.handleViewAction({
type: ActionTypes.RECIEVED_MENTION_DATA, type: ActionTypes.RECIEVED_MENTION_DATA,
id: this.props.id, id: this.props.id,
mention_text: mentionText mention_text: mentionText
}); });
}.bind(this), 1); }, 1);
} }
handleChange() { handleChange() {
this.props.onUserInput(React.findDOMNode(this.refs.message).value); this.props.onUserInput(React.findDOMNode(this.refs.message).value);
} }
handleKeyPress(e) { handleKeyPress(e) {
const text = React.findDOMNode(this.refs.message).value; const text = React.findDOMNode(this.refs.message).value;
@@ -157,6 +142,7 @@ export default class Textbox extends React.Component {
this.props.onKeyPress(e); this.props.onKeyPress(e);
} }
handleKeyDown(e) { handleKeyDown(e) {
if (Utils.getSelectedText(React.findDOMNode(this.refs.message)) !== '') { if (Utils.getSelectedText(React.findDOMNode(this.refs.message)) !== '') {
this.doProcessMentions = true; this.doProcessMentions = true;
@@ -166,6 +152,7 @@ export default class Textbox extends React.Component {
this.handleBackspace(e); this.handleBackspace(e);
} }
} }
handleBackspace() { handleBackspace() {
const text = React.findDOMNode(this.refs.message).value; const text = React.findDOMNode(this.refs.message).value;
if (text.indexOf('/') === 0) { if (text.indexOf('/') === 0) {
@@ -185,6 +172,7 @@ export default class Textbox extends React.Component {
this.doProcessMentions = true; this.doProcessMentions = true;
} }
} }
checkForNewMention(text) { checkForNewMention(text) {
const caret = Utils.getCaretPosition(React.findDOMNode(this.refs.message)); const caret = Utils.getCaretPosition(React.findDOMNode(this.refs.message));
@@ -211,6 +199,7 @@ export default class Textbox extends React.Component {
const name = preText.substring(atIndex + 1, preText.length).toLowerCase(); const name = preText.substring(atIndex + 1, preText.length).toLowerCase();
this.updateMentionTab(name); this.updateMentionTab(name);
} }
addMention(name) { addMention(name) {
const caret = Utils.getCaretPosition(React.findDOMNode(this.refs.message)); const caret = Utils.getCaretPosition(React.findDOMNode(this.refs.message));
@@ -233,11 +222,13 @@ export default class Textbox extends React.Component {
this.props.onUserInput(`${prefix}@${name} ${suffix}`); this.props.onUserInput(`${prefix}@${name} ${suffix}`);
} }
addCommand(cmd) { addCommand(cmd) {
const elm = React.findDOMNode(this.refs.message); const elm = React.findDOMNode(this.refs.message);
elm.value = cmd; elm.value = cmd;
this.handleChange(); this.handleChange();
} }
resize() { resize() {
const e = React.findDOMNode(this.refs.message); const e = React.findDOMNode(this.refs.message);
const w = React.findDOMNode(this.refs.wrapper); const w = React.findDOMNode(this.refs.wrapper);
@@ -264,21 +255,25 @@ export default class Textbox extends React.Component {
this.props.onHeightChange(); this.props.onHeightChange();
} }
} }
handleFocus() { handleFocus() {
const elm = React.findDOMNode(this.refs.message); const elm = React.findDOMNode(this.refs.message);
if (elm.title === elm.value) { if (elm.title === elm.value) {
elm.value = ''; elm.value = '';
} }
} }
handleBlur() { handleBlur() {
const elm = React.findDOMNode(this.refs.message); const elm = React.findDOMNode(this.refs.message);
if (elm.value === '') { if (elm.value === '') {
elm.value = elm.title; elm.value = elm.title;
} }
} }
handlePaste() { handlePaste() {
this.doProcessMentions = true; this.doProcessMentions = true;
} }
render() { render() {
return ( return (
<div <div

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

@@ -53,9 +53,12 @@ export default class CustomThemeChooser extends React.Component {
const elements = []; const elements = [];
let colors = ''; let colors = '';
Constants.THEME_ELEMENTS.forEach((element) => { Constants.THEME_ELEMENTS.forEach((element, index) => {
elements.push( elements.push(
<div className='col-sm-4 form-group'> <div
className='col-sm-4 form-group'
key={'custom-theme-key' + index}
>
<label className='custom-label'>{element.uiName}</label> <label className='custom-label'>{element.uiName}</label>
<div <div
className='input-group color-picker' className='input-group color-picker'

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

@@ -107,23 +107,23 @@ export default class ManageIncomingHooks extends React.Component {
this.state.hooks.forEach((hook) => { this.state.hooks.forEach((hook) => {
const c = ChannelStore.get(hook.channel_id); const c = ChannelStore.get(hook.channel_id);
hooks.push( hooks.push(
<div> <div className='font--small'>
<div className='divider-light'></div> <div className='padding-top x2 divider-light'></div>
<span> <div className='padding-top x2'>
<strong>{'URL: '}</strong>{Utils.getWindowLocationOrigin() + '/hooks/' + hook.id} <strong>{'URL: '}</strong><span className='word-break--all'>{Utils.getWindowLocationOrigin() + '/hooks/' + hook.id}</span>
</span> </div>
<br/> <div className='padding-top'>
<span>
<strong>{'Channel: '}</strong>{c.name} <strong>{'Channel: '}</strong>{c.name}
</span> </div>
<br/> <div className='padding-top'>
<a <a
className={'btn btn-sm btn-primary'} className={'text-danger'}
href='#' href='#'
onClick={this.removeHook.bind(this, hook.id)} onClick={this.removeHook.bind(this, hook.id)}
> >
{'Remove'} {'Remove'}
</a> </a>
</div>
</div> </div>
); );
}); });
@@ -134,41 +134,38 @@ export default class ManageIncomingHooks extends React.Component {
} else if (hooks.length > 0) { } else if (hooks.length > 0) {
displayHooks = hooks; displayHooks = hooks;
} else { } else {
displayHooks = <label>{'None'}</label>; displayHooks = <label>{': None'}</label>;
} }
const existingHooks = ( const existingHooks = (
<div> <div className='padding-top x2'>
<label className='control-label'>{'Existing incoming webhooks'}</label> <label className='control-label padding-top x2'>{'Existing incoming webhooks'}</label>
<br/>
{displayHooks} {displayHooks}
</div> </div>
); );
return ( return (
<div <div key='addIncomingHook'>
key='addIncomingHook'
className='form-group'
>
<label className='control-label'>{'Add a new incoming webhook'}</label> <label className='control-label'>{'Add a new incoming webhook'}</label>
<br/> <div className='padding-top'>
<div>
<select <select
ref='channelName' ref='channelName'
className='form-control'
value={this.state.channelId} value={this.state.channelId}
onChange={this.updateChannelId} onChange={this.updateChannelId}
> >
{options} {options}
</select> </select>
<br/>
{serverError} {serverError}
<a <div className='padding-top'>
className={'btn btn-sm btn-primary' + disableButton} <a
href='#' className={'btn btn-sm btn-primary' + disableButton}
onClick={this.addNewHook} href='#'
> onClick={this.addNewHook}
{'Add'} >
</a> {'Add'}
</a>
</div>
</div> </div>
{existingHooks} {existingHooks}
</div> </div>

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

@@ -23,7 +23,10 @@ export default class PremadeThemeChooser extends React.Component {
} }
premadeThemes.push( premadeThemes.push(
<div className='col-sm-3 premade-themes'> <div
className='col-sm-3 premade-themes'
key={'premade-theme-key' + k}
>
<div <div
className={activeClass} className={activeClass}
onClick={() => this.props.updateTheme(premadeTheme)} onClick={() => this.props.updateTheme(premadeTheme)}

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

@@ -81,6 +81,8 @@ export default class UserSettingsAppearance extends React.Component {
$('#user_settings').off('hidden.bs.modal', this.handleClose); $('#user_settings').off('hidden.bs.modal', this.handleClose);
this.props.updateTab('general'); this.props.updateTab('general');
$('.ps-container.modal-body').scrollTop(0);
$('.ps-container.modal-body').perfectScrollbar('update');
$('#user_settings').modal('hide'); $('#user_settings').modal('hide');
}, },
(err) => { (err) => {

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

@@ -265,9 +265,12 @@ export default class NotificationsTab extends React.Component {
e.preventDefault(); e.preventDefault();
}.bind(this); }.bind(this);
const extraInfo = <span>{'Desktop notifications are available on Firefox, Safari, and Chrome.'}</span>;
desktopSection = ( desktopSection = (
<SettingItemMax <SettingItemMax
title='Send desktop notifications' title='Send desktop notifications'
extraInfo={extraInfo}
inputs={inputs} inputs={inputs}
submit={this.handleSubmit} submit={this.handleSubmit}
server_error={serverError} server_error={serverError}
@@ -343,9 +346,12 @@ export default class NotificationsTab extends React.Component {
e.preventDefault(); e.preventDefault();
}.bind(this); }.bind(this);
const extraInfo = <span>{'Desktop notification sounds are available on Firefox, Safari, Chrome, Internet Explorer, and Edge.'}</span>;
soundSection = ( soundSection = (
<SettingItemMax <SettingItemMax
title='Desktop notification sounds' title='Desktop notification sounds'
extraInfo={extraInfo}
inputs={inputs} inputs={inputs}
submit={this.handleSubmit} submit={this.handleSubmit}
server_error={serverError} server_error={serverError}

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

@@ -1,8 +1,11 @@
// 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.
var Client = require('../utils/client.jsx'); const Client = require('../utils/client.jsx');
var Utils = require('../utils/utils.jsx'); const Utils = require('../utils/utils.jsx');
const Constants = require('../utils/constants.jsx');
const ViewImagePopoverBar = require('./view_image_popover_bar.jsx');
const Modal = ReactBootstrap.Modal;
export default class ViewImageModal extends React.Component { export default class ViewImageModal extends React.Component {
constructor(props) { constructor(props) {
@@ -16,6 +19,10 @@ export default class ViewImageModal extends React.Component {
this.handleKeyPress = this.handleKeyPress.bind(this); this.handleKeyPress = this.handleKeyPress.bind(this);
this.getPublicLink = this.getPublicLink.bind(this); this.getPublicLink = this.getPublicLink.bind(this);
this.getPreviewImagePath = this.getPreviewImagePath.bind(this); this.getPreviewImagePath = this.getPreviewImagePath.bind(this);
this.onModalShown = this.onModalShown.bind(this);
this.onModalHidden = this.onModalHidden.bind(this);
this.onMouseEnterImage = this.onMouseEnterImage.bind(this);
this.onMouseLeaveImage = this.onMouseLeaveImage.bind(this);
var loaded = []; var loaded = [];
var progress = []; var progress = [];
@@ -23,9 +30,20 @@ export default class ViewImageModal extends React.Component {
loaded.push(false); loaded.push(false);
progress.push(0); progress.push(0);
} }
this.state = {imgId: this.props.startId, viewed: false, loaded: loaded, progress: progress, images: {}, fileSizes: {}}; this.state = {
imgId: this.props.startId,
imgHeight: '100%',
loaded: loaded,
progress: progress,
images: {},
fileSizes: {},
showFooter: false
};
} }
handleNext() { handleNext(e) {
if (e) {
e.stopPropagation();
}
var id = this.state.imgId + 1; var id = this.state.imgId + 1;
if (id > this.props.filenames.length - 1) { if (id > this.props.filenames.length - 1) {
id = 0; id = 0;
@@ -33,7 +51,10 @@ export default class ViewImageModal extends React.Component {
this.setState({imgId: id}); this.setState({imgId: id});
this.loadImage(id); this.loadImage(id);
} }
handlePrev() { handlePrev(e) {
if (e) {
e.stopPropagation();
}
var id = this.state.imgId - 1; var id = this.state.imgId - 1;
if (id < 0) { if (id < 0) {
id = this.props.filenames.length - 1; id = this.props.filenames.length - 1;
@@ -50,15 +71,27 @@ export default class ViewImageModal extends React.Component {
this.handlePrev(); this.handlePrev();
} }
} }
componentWillReceiveProps(nextProps) { onModalShown(nextProps) {
this.setState({imgId: nextProps.startId}); this.setState({imgId: nextProps.startId});
this.loadImage(nextProps.startId);
}
onModalHidden() {
if (this.refs.video) {
var video = React.findDOMNode(this.refs.video);
video.pause();
video.currentTime = 0;
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.show === true && this.props.show === false) {
this.onModalShown(nextProps);
} else if (nextProps.show === false && this.props.show === true) {
this.onModalHidden();
}
} }
loadImage(id) { loadImage(id) {
var imgHeight = $(window).height() - 100; var imgHeight = $(window).height() - 100;
if (this.state.loaded[id] || this.state.images[id]) { this.setState({imgHeight});
$('.modal .modal-image .image-wrapper img').css('max-height', imgHeight);
return;
}
var filename = this.props.filenames[id]; var filename = this.props.filenames[id];
@@ -68,84 +101,27 @@ export default class ViewImageModal extends React.Component {
if (fileType === 'image') { if (fileType === 'image') {
var img = new Image(); var img = new Image();
img.load(this.getPreviewImagePath(filename), img.load(this.getPreviewImagePath(filename),
function load() { () => {
var progress = this.state.progress; const progress = this.state.progress;
progress[id] = img.completedPercentage; progress[id] = img.completedPercentage;
this.setState({progress: progress}); this.setState({progress});
}.bind(this)); });
img.onload = (function onload(imgid) { img.onload = () => {
return function onloadReturn() { const loaded = this.state.loaded;
var loaded = this.state.loaded; loaded[id] = true;
loaded[imgid] = true; this.setState({loaded});
this.setState({loaded: loaded}); };
$(React.findDOMNode(this.refs.image)).css('max-height', imgHeight);
}.bind(this);
}.bind(this)(id));
var images = this.state.images; var images = this.state.images;
images[id] = img; images[id] = img;
this.setState({images: images}); this.setState({images});
} else { } else {
// there's nothing to load for non-image files // there's nothing to load for non-image files
var loaded = this.state.loaded; var loaded = this.state.loaded;
loaded[id] = true; loaded[id] = true;
this.setState({loaded: loaded}); this.setState({loaded});
}
}
componentDidUpdate() {
if (this.state.loaded[this.state.imgId]) {
if (this.refs.imageWrap) {
$(React.findDOMNode(this.refs.imageWrap)).removeClass('default');
}
} }
} }
componentDidMount() { componentDidMount() {
$('#' + this.props.modalId).on('shown.bs.modal', function onModalShow() {
this.setState({viewed: true});
this.loadImage(this.state.imgId);
}.bind(this));
$('#' + this.props.modalId).on('hidden.bs.modal', function onModalHide() {
if (this.refs.video) {
var video = React.findDOMNode(this.refs.video);
video.pause();
video.currentTime = 0;
}
}.bind(this));
$(React.findDOMNode(this.refs.modal)).click(function onModalClick(e) {
if (e.target === this || e.target === React.findDOMNode(this.refs.imageBody)) {
$('.image_modal').modal('hide');
}
}.bind(this));
$(React.findDOMNode(this.refs.imageWrap)).hover(
function onModalHover() {
$(React.findDOMNode(this.refs.imageFooter)).addClass('footer--show');
}.bind(this), function offModalHover() {
$(React.findDOMNode(this.refs.imageFooter)).removeClass('footer--show');
}.bind(this)
);
if (this.refs.previewArrowLeft) {
$(React.findDOMNode(this.refs.previewArrowLeft)).hover(
function onModalHover() {
$(React.findDOMNode(this.refs.imageFooter)).addClass('footer--show');
}.bind(this), function offModalHover() {
$(React.findDOMNode(this.refs.imageFooter)).removeClass('footer--show');
}.bind(this)
);
}
if (this.refs.previewArrowRight) {
$(React.findDOMNode(this.refs.previewArrowRight)).hover(
function onModalHover() {
$(React.findDOMNode(this.refs.imageFooter)).addClass('footer--show');
}.bind(this), function offModalHover() {
$(React.findDOMNode(this.refs.imageFooter)).removeClass('footer--show');
}.bind(this)
);
}
$(window).on('keyup', this.handleKeyPress); $(window).on('keyup', this.handleKeyPress);
// keep track of whether or not this component is mounted so we can safely set the state asynchronously // keep track of whether or not this component is mounted so we can safely set the state asynchronously
@@ -189,6 +165,12 @@ export default class ViewImageModal extends React.Component {
// only images have proper previews, so just use a placeholder icon for non-images // only images have proper previews, so just use a placeholder icon for non-images
return Utils.getPreviewImagePathForFileType(fileType); return Utils.getPreviewImagePathForFileType(fileType);
} }
onMouseEnterImage() {
this.setState({showFooter: true});
}
onMouseLeaveImage() {
this.setState({showFooter: false});
}
render() { render() {
if (this.props.filenames.length < 1 || this.props.filenames.length - 1 < this.state.imgId) { if (this.props.filenames.length < 1 || this.props.filenames.length - 1 < this.state.imgId) {
return <div/>; return <div/>;
@@ -219,11 +201,20 @@ export default class ViewImageModal extends React.Component {
</a> </a>
); );
} else if (fileType === 'video' || fileType === 'audio') { } else if (fileType === 'video' || fileType === 'audio') {
let width = Constants.WEB_VIDEO_WIDTH;
let height = Constants.WEB_VIDEO_HEIGHT;
if (Utils.isMobile()) {
width = Constants.MOBILE_VIDEO_WIDTH;
height = Constants.MOBILE_VIDEO_HEIGHT;
}
content = ( content = (
<video <video
ref='video' ref='video'
data-setup='{}' data-setup='{}'
controls='controls' controls='controls'
width={width}
height={height}
> >
<source src={Utils.getWindowLocationOrigin() + '/api/v1/files/get' + filename} /> <source src={Utils.getWindowLocationOrigin() + '/api/v1/files/get' + filename} />
</video> </video>
@@ -299,23 +290,6 @@ export default class ViewImageModal extends React.Component {
bgClass = 'black-bg'; bgClass = 'black-bg';
} }
var publicLink = '';
if (global.window.config.EnablePublicLink === 'true') {
publicLink = (
<div>
<a
href='#'
className='public-link text'
data-title='Public Image'
onClick={this.getPublicLink}
>
Get Public Link
</a>
<span className='text'> | </span>
</div>
);
}
var leftArrow = ''; var leftArrow = '';
var rightArrow = ''; var rightArrow = '';
if (this.props.filenames.length > 1) { if (this.props.filenames.length > 1) {
@@ -342,65 +316,61 @@ export default class ViewImageModal extends React.Component {
); );
} }
let closeButtonClass = 'modal-close';
if (this.state.showFooter) {
closeButtonClass += ' modal-close--show';
}
return ( return (
<div <Modal
className='modal fade image_modal' show={this.props.show}
ref='modal' onHide={this.props.onModalDismissed}
id={this.props.modalId} className='image_modal'
tabIndex='-1' dialogClassName='modal-image'
role='dialog'
aria-hidden='true'
> >
<div className='modal-dialog modal-image'> <Modal.Body
<div className='modal-content image-content'> modalClassName='image-body'
onClick={this.props.onModalDismissed}
>
<div
className={'image-wrapper ' + bgClass}
style={{maxHeight: this.state.imgHeight}}
onMouseEnter={this.onMouseEnterImage}
onMouseLeave={this.onMouseLeaveImage}
onClick={(e) => e.stopPropagation()}
>
<div <div
ref='imageBody' className={closeButtonClass}
className='modal-body image-body' onClick={this.props.onModalDismissed}
> />
<div {content}
ref='imageWrap' <ViewImagePopoverBar
className={'image-wrapper default ' + bgClass} show={this.state.showFooter}
> fileId={this.state.imgId}
<div totalFiles={this.props.filenames.length}
className='modal-close' filename={name}
data-dismiss='modal' fileURL={fileUrl}
/> onGetPublicLinkPressed={this.getPublicLink}
{content} />
<div
ref='imageFooter'
className='modal-button-bar'
>
<span className='pull-left text'>{'File ' + (this.state.imgId + 1) + ' of ' + this.props.filenames.length}</span>
<div className='image-links'>
{publicLink}
<a
href={fileUrl}
download={name}
className='text'
>
Download
</a>
</div>
</div>
</div>
{leftArrow}
{rightArrow}
</div>
</div> </div>
</div> {leftArrow}
</div> {rightArrow}
</Modal.Body>
</Modal>
); );
} }
} }
ViewImageModal.defaultProps = { ViewImageModal.defaultProps = {
show: false,
filenames: [], filenames: [],
modalId: '',
channelId: '', channelId: '',
userId: '', userId: '',
startId: 0 startId: 0
}; };
ViewImageModal.propTypes = { ViewImageModal.propTypes = {
show: React.PropTypes.bool.isRequired,
onModalDismissed: React.PropTypes.func.isRequired,
filenames: React.PropTypes.array, filenames: React.PropTypes.array,
modalId: React.PropTypes.string, modalId: React.PropTypes.string,
channelId: React.PropTypes.string, channelId: React.PropTypes.string,

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

@@ -0,0 +1,66 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
export default class ViewImagePopoverBar extends React.Component {
constructor(props) {
super(props);
}
render() {
var publicLink = '';
if (global.window.config.EnablePublicLink === 'true') {
publicLink = (
<div>
<a
href='#'
className='public-link text'
data-title='Public Image'
onClick={this.getPublicLink}
>
{'Get Public Link'}
</a>
<span className='text'>{' | '}</span>
</div>
);
}
var footerClass = 'modal-button-bar';
if (this.props.show) {
footerClass += ' footer--show';
}
return (
<div
ref='imageFooter'
className={footerClass}
>
<span className='pull-left text'>{'File ' + (this.props.fileId + 1) + ' of ' + this.props.totalFiles}</span>
<div className='image-links'>
{publicLink}
<a
href={this.props.fileURL}
download={this.props.filename}
className='text'
>
{'Download'}
</a>
</div>
</div>
);
}
}
ViewImagePopoverBar.defaultProps = {
show: false,
imgId: 0,
totalFiles: 0,
filename: '',
fileURL: ''
};
ViewImagePopoverBar.propTypes = {
show: React.PropTypes.bool.isRequired,
fileId: React.PropTypes.number.isRequired,
totalFiles: React.PropTypes.number.isRequired,
filename: React.PropTypes.string.isRequired,
fileURL: React.PropTypes.string.isRequired,
onGetPublicLinkPressed: React.PropTypes.func.isRequired
};

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

@@ -26,6 +26,7 @@ var ChannelInviteModal = require('../components/channel_invite_modal.jsx');
var TeamMembersModal = require('../components/team_members.jsx'); var TeamMembersModal = require('../components/team_members.jsx');
var DirectChannelModal = require('../components/more_direct_channels.jsx'); var DirectChannelModal = require('../components/more_direct_channels.jsx');
var ErrorBar = require('../components/error_bar.jsx'); var ErrorBar = require('../components/error_bar.jsx');
var ErrorStore = require('../stores/error_store.jsx');
var ChannelLoader = require('../components/channel_loader.jsx'); var ChannelLoader = require('../components/channel_loader.jsx');
var MentionList = require('../components/mention_list.jsx'); var MentionList = require('../components/mention_list.jsx');
var ChannelInfoModal = require('../components/channel_info_modal.jsx'); var ChannelInfoModal = require('../components/channel_info_modal.jsx');
@@ -234,6 +235,11 @@ function setupChannelPage(props) {
<RegisterAppModal />, <RegisterAppModal />,
document.getElementById('register_app_modal') document.getElementById('register_app_modal')
); );
if (global.window.config.SendEmailNotifications === 'false') {
ErrorStore.storeLastError({message: 'Preview Mode: Email notifications have not been configured'});
ErrorStore.emitChange();
}
} }
global.window.setup_channel_page = setupChannelPage; global.window.setup_channel_page = setupChannelPage;

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

@@ -4,11 +4,14 @@
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
var EventEmitter = require('events').EventEmitter; var EventEmitter = require('events').EventEmitter;
var BrowserStore = require('../stores/browser_store.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes; var ActionTypes = Constants.ActionTypes;
var LOG_CHANGE_EVENT = 'log_change'; var LOG_CHANGE_EVENT = 'log_change';
var CONFIG_CHANGE_EVENT = 'config_change'; var CONFIG_CHANGE_EVENT = 'config_change';
var ALL_TEAMS_EVENT = 'all_team_change';
class AdminStoreClass extends EventEmitter { class AdminStoreClass extends EventEmitter {
constructor() { constructor() {
@@ -16,6 +19,7 @@ class AdminStoreClass extends EventEmitter {
this.logs = null; this.logs = null;
this.config = null; this.config = null;
this.teams = null;
this.emitLogChange = this.emitLogChange.bind(this); this.emitLogChange = this.emitLogChange.bind(this);
this.addLogChangeListener = this.addLogChangeListener.bind(this); this.addLogChangeListener = this.addLogChangeListener.bind(this);
@@ -24,6 +28,10 @@ class AdminStoreClass extends EventEmitter {
this.emitConfigChange = this.emitConfigChange.bind(this); this.emitConfigChange = this.emitConfigChange.bind(this);
this.addConfigChangeListener = this.addConfigChangeListener.bind(this); this.addConfigChangeListener = this.addConfigChangeListener.bind(this);
this.removeConfigChangeListener = this.removeConfigChangeListener.bind(this); this.removeConfigChangeListener = this.removeConfigChangeListener.bind(this);
this.emitAllTeamsChange = this.emitAllTeamsChange.bind(this);
this.addAllTeamsChangeListener = this.addAllTeamsChangeListener.bind(this);
this.removeAllTeamsChangeListener = this.removeAllTeamsChangeListener.bind(this);
} }
emitLogChange() { emitLogChange() {
@@ -50,6 +58,18 @@ class AdminStoreClass extends EventEmitter {
this.removeListener(CONFIG_CHANGE_EVENT, callback); this.removeListener(CONFIG_CHANGE_EVENT, callback);
} }
emitAllTeamsChange() {
this.emit(ALL_TEAMS_EVENT);
}
addAllTeamsChangeListener(callback) {
this.on(ALL_TEAMS_EVENT, callback);
}
removeAllTeamsChangeListener(callback) {
this.removeListener(ALL_TEAMS_EVENT, callback);
}
getLogs() { getLogs() {
return this.logs; return this.logs;
} }
@@ -65,6 +85,22 @@ class AdminStoreClass extends EventEmitter {
saveConfig(config) { saveConfig(config) {
this.config = config; this.config = config;
} }
getAllTeams() {
return this.teams;
}
saveAllTeams(teams) {
this.teams = teams;
}
getSelectedTeams() {
return BrowserStore.getItem('seleted_teams');
}
saveSelectedTeams(teams) {
BrowserStore.setItem('seleted_teams', teams);
}
} }
var AdminStore = new AdminStoreClass(); var AdminStore = new AdminStoreClass();
@@ -81,6 +117,10 @@ AdminStoreClass.dispatchToken = AppDispatcher.register((payload) => {
AdminStore.saveConfig(action.config); AdminStore.saveConfig(action.config);
AdminStore.emitConfigChange(); AdminStore.emitConfigChange();
break; break;
case ActionTypes.RECIEVED_ALL_TEAMS:
AdminStore.saveAllTeams(action.teams);
AdminStore.emitAllTeamsChange();
break;
default: default:
} }
}); });

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

@@ -48,7 +48,7 @@ class ErrorStoreClass extends EventEmitter {
var ErrorStore = new ErrorStoreClass(); var ErrorStore = new ErrorStoreClass();
ErrorStore.dispatchToken = AppDispatcher.register(function registry(payload) { ErrorStore.dispatchToken = AppDispatcher.register((payload) => {
var action = payload.action; var action = payload.action;
switch (action.type) { switch (action.type) {
case ActionTypes.RECIEVED_ERROR: case ActionTypes.RECIEVED_ERROR:

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

@@ -3,6 +3,7 @@
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
var UserStore = require('./user_store.jsx'); var UserStore = require('./user_store.jsx');
var ErrorStore = require('./error_store.jsx');
var EventEmitter = require('events').EventEmitter; var EventEmitter = require('events').EventEmitter;
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
@@ -21,6 +22,7 @@ class SocketStoreClass extends EventEmitter {
this.addChangeListener = this.addChangeListener.bind(this); this.addChangeListener = this.addChangeListener.bind(this);
this.removeChangeListener = this.removeChangeListener.bind(this); this.removeChangeListener = this.removeChangeListener.bind(this);
this.sendMessage = this.sendMessage.bind(this); this.sendMessage = this.sendMessage.bind(this);
this.failCount = 0;
this.initialize(); this.initialize();
} }
@@ -37,27 +39,43 @@ class SocketStoreClass extends EventEmitter {
protocol = 'wss://'; protocol = 'wss://';
} }
var connUrl = protocol + location.host + '/api/v1/websocket'; var connUrl = protocol + location.host + '/api/v1/websocket';
console.log('connecting to ' + connUrl); //eslint-disable-line no-console if (this.failCount === 0) {
console.log('websocket connecting to ' + connUrl); //eslint-disable-line no-console
}
conn = new WebSocket(connUrl); conn = new WebSocket(connUrl);
conn.onclose = function closeConn(evt) { conn.onopen = () => {
console.log('websocket closed'); //eslint-disable-line no-console if (this.failCount > 0) {
console.log(evt); //eslint-disable-line no-console console.log('websocket re-established connection'); //eslint-disable-line no-console
conn = null; }
setTimeout(
function reconnect() {
this.initialize();
}.bind(this),
3000
);
}.bind(this);
conn.onerror = function connError(evt) { this.failCount = 0;
console.log('websocket error'); //eslint-disable-line no-console ErrorStore.storeLastError(null);
console.log(evt); //eslint-disable-line no-console ErrorStore.emitChange();
}; };
conn.onmessage = function connMessage(evt) { conn.onclose = () => {
conn = null;
setTimeout(
() => {
this.initialize();
},
3000
);
};
conn.onerror = (evt) => {
if (this.failCount === 0) {
console.log('websocket error ' + evt); //eslint-disable-line no-console
}
this.failCount = this.failCount + 1;
ErrorStore.storeLastError({connErrorCount: this.failCount, message: 'We cannot reach the Mattermost service. The service may be down or misconfigured. Please contact an administrator to make sure the WebSocket port is configured properly.'});
ErrorStore.emitChange();
};
conn.onmessage = (evt) => {
AppDispatcher.handleServerAction({ AppDispatcher.handleServerAction({
type: ActionTypes.RECIEVED_MSG, type: ActionTypes.RECIEVED_MSG,
msg: JSON.parse(evt.data) msg: JSON.parse(evt.data)
@@ -86,7 +104,7 @@ class SocketStoreClass extends EventEmitter {
var SocketStore = new SocketStoreClass(); var SocketStore = new SocketStoreClass();
SocketStore.dispatchToken = AppDispatcher.register(function registry(payload) { SocketStore.dispatchToken = AppDispatcher.register((payload) => {
var action = payload.action; var action = payload.action;
switch (action.type) { switch (action.type) {

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

@@ -371,6 +371,32 @@ export function getConfig() {
); );
} }
export function getAllTeams() {
if (isCallInProgress('getAllTeams')) {
return;
}
callTracker.getAllTeams = utils.getTimestamp();
client.getAllTeams(
(data, textStatus, xhr) => {
callTracker.getAllTeams = 0;
if (xhr.status === 304 || !data) {
return;
}
AppDispatcher.handleServerAction({
type: ActionTypes.RECIEVED_ALL_TEAMS,
teams: data
});
},
(err) => {
callTracker.getAllTeams = 0;
dispatchError(err, 'getAllTeams');
}
);
}
export function findTeams(email) { export function findTeams(email) {
if (isCallInProgress('findTeams_' + email)) { if (isCallInProgress('findTeams_' + email)) {
return; return;

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

@@ -27,7 +27,7 @@ function handleError(methodName, xhr, status, err) {
msg = 'error in ' + methodName + ' status=' + status + ' statusCode=' + xhr.status + ' err=' + err; msg = 'error in ' + methodName + ' status=' + status + ' statusCode=' + xhr.status + ' err=' + err;
if (xhr.status === 0) { if (xhr.status === 0) {
e = {message: 'There appears to be a problem with your internet connection'}; e = {message: 'There appears to be a problem with your internet connection', connErrorCount: 1};
} else { } else {
e = {message: 'We received an unexpected status code from the server (' + xhr.status + ')'}; e = {message: 'We received an unexpected status code from the server (' + xhr.status + ')'};
} }
@@ -347,6 +347,20 @@ export function testEmail(config, success, error) {
}); });
} }
export function getAllTeams(success, error) {
$.ajax({
url: '/api/v1/teams/all',
dataType: 'json',
contentType: 'application/json',
type: 'GET',
success,
error: function onError(xhr, status, err) {
var e = handleError('getAllTeams', xhr, status, err);
error(e);
}
});
}
export function getMeSynchronous(success, error) { export function getMeSynchronous(success, error) {
var currentUser = null; var currentUser = null;
$.ajax({ $.ajax({
@@ -890,6 +904,21 @@ export function getProfiles(success, error) {
}); });
} }
export function getProfilesForTeam(teamId, success, error) {
$.ajax({
cache: false,
url: '/api/v1/users/profiles/' + teamId,
dataType: 'json',
contentType: 'application/json',
type: 'GET',
success,
error: function onError(xhr, status, err) {
var e = handleError('getProfilesForTeam', xhr, status, err);
error(e);
}
});
}
export function uploadFile(formData, success, error) { export function uploadFile(formData, success, error) {
var request = $.ajax({ var request = $.ajax({
url: '/api/v1/files/upload', url: '/api/v1/files/upload',
@@ -1013,23 +1042,6 @@ export function getMyTeam(success, error) {
}); });
} }
export function updateValetFeature(data, success, error) {
$.ajax({
url: '/api/v1/teams/update_valet_feature',
dataType: 'json',
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
success,
error: function onError(xhr, status, err) {
var e = handleError('updateValetFeature', xhr, status, err);
error(e);
}
});
track('api', 'api_teams_update_valet_feature');
}
export function registerOAuthApp(app, success, error) { export function registerOAuthApp(app, success, error) {
$.ajax({ $.ajax({
url: '/api/v1/oauth/register', url: '/api/v1/oauth/register',

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

@@ -35,8 +35,8 @@ module.exports = {
RECIEVED_TEAM: null, RECIEVED_TEAM: null,
RECIEVED_CONFIG: null, RECIEVED_CONFIG: null,
RECIEVED_LOGS: null, RECIEVED_LOGS: null,
RECIEVED_ALL_TEAMS: null,
TOGGLE_IMPORT_THEME_MODAL: null TOGGLE_IMPORT_THEME_MODAL: null
}), }),
@@ -72,6 +72,10 @@ module.exports = {
MAX_FILE_SIZE: 50000000, // 50 MB MAX_FILE_SIZE: 50000000, // 50 MB
THUMBNAIL_WIDTH: 128, THUMBNAIL_WIDTH: 128,
THUMBNAIL_HEIGHT: 100, THUMBNAIL_HEIGHT: 100,
WEB_VIDEO_WIDTH: 640,
WEB_VIDEO_HEIGHT: 480,
MOBILE_VIDEO_WIDTH: 480,
MOBILE_VIDEO_HEIGHT: 360,
DEFAULT_CHANNEL: 'town-square', DEFAULT_CHANNEL: 'town-square',
OFFTOPIC_CHANNEL: 'off-topic', OFFTOPIC_CHANNEL: 'off-topic',
GITLAB_SERVICE: 'gitlab', GITLAB_SERVICE: 'gitlab',
@@ -130,32 +134,34 @@ module.exports = {
mentionColor: '#ffffff', mentionColor: '#ffffff',
centerChannelBg: '#ffffff', centerChannelBg: '#ffffff',
centerChannelColor: '#333333', centerChannelColor: '#333333',
newMessageSeparator: '#FF8800',
linkColor: '#2389d7', linkColor: '#2389d7',
buttonBg: '#2389d7', buttonBg: '#2389d7',
buttonColor: '#FFFFFF' buttonColor: '#FFFFFF'
}, },
slack: { organization: {
type: 'Slack', type: 'Organization',
sidebarBg: '#4D394B', sidebarBg: '#2071a7',
sidebarText: '#ab9ba9', sidebarText: '#bfcde8',
sidebarUnreadText: '#FFFFFF', sidebarUnreadText: '#fff',
sidebarTextHoverBg: '#3e313c', sidebarTextHoverBg: '#136197',
sidebarTextHoverColor: '#ab9ba9', sidebarTextHoverColor: '#bfcde8',
sidebarTextActiveBg: '#4c9689', sidebarTextActiveBg: '#136197',
sidebarTextActiveColor: '#FFFFFF', sidebarTextActiveColor: '#FFFFFF',
sidebarHeaderBg: '#4D394B', sidebarHeaderBg: '#2f81b7',
sidebarHeaderTextColor: '#FFFFFF', sidebarHeaderTextColor: '#FFFFFF',
onlineIndicator: '#4c9689', onlineIndicator: '#7DBE00',
mentionBj: '#eb4d5c', mentionBj: '#136197',
mentionColor: '#FFFFFF', mentionColor: '#bfcde8',
centerChannelBg: '#FFFFFF', centerChannelBg: '#f2f4f8',
centerChannelColor: '#333333', centerChannelColor: '#333333',
linkColor: '#2389d7', newMessageSeparator: '#FF8800',
buttonBg: '#26a970', linkColor: '#2f81b7',
buttonBg: '#1dacfc',
buttonColor: '#FFFFFF' buttonColor: '#FFFFFF'
}, },
dark: { mattermostDark: {
type: 'Dark', type: 'Mattermost Dark',
sidebarBg: '#1B2C3E', sidebarBg: '#1B2C3E',
sidebarText: '#bbbbbb', sidebarText: '#bbbbbb',
sidebarUnreadText: '#fff', sidebarUnreadText: '#fff',
@@ -165,13 +171,35 @@ module.exports = {
sidebarTextActiveColor: '#FFFFFF', sidebarTextActiveColor: '#FFFFFF',
sidebarHeaderBg: '#1B2C3E', sidebarHeaderBg: '#1B2C3E',
sidebarHeaderTextColor: '#FFFFFF', sidebarHeaderTextColor: '#FFFFFF',
onlineIndicator: '#4c9689', onlineIndicator: '#55C5B2',
mentionBj: '#B74A4A', mentionBj: '#B74A4A',
mentionColor: '#FFFFFF', mentionColor: '#FFFFFF',
centerChannelBg: '#2F3E4E', centerChannelBg: '#2F3E4E',
centerChannelColor: '#DDDDDD', centerChannelColor: '#DDDDDD',
newMessageSeparator: '#5de5da',
linkColor: '#A4FFEB', linkColor: '#A4FFEB',
buttonBg: '#2B9C99', buttonBg: '#1dacfc',
buttonColor: '#FFFFFF'
},
windows10: {
type: 'Windows Dark',
sidebarBg: '#171717',
sidebarText: '#eee',
sidebarUnreadText: '#fff',
sidebarTextHoverBg: '#302e30',
sidebarTextHoverColor: '#fff',
sidebarTextActiveBg: '#484748',
sidebarTextActiveColor: '#FFFFFF',
sidebarHeaderBg: '#1f1f1f',
sidebarHeaderTextColor: '#FFFFFF',
onlineIndicator: '#0177e7',
mentionBj: '#0177e7',
mentionColor: '#FFFFFF',
centerChannelBg: '#1F1F1F',
centerChannelColor: '#DDDDDD',
newMessageSeparator: '#CC992D',
linkColor: '#0177e7',
buttonBg: '#0177e7',
buttonColor: '#FFFFFF' buttonColor: '#FFFFFF'
} }
}, },
@@ -182,7 +210,7 @@ module.exports = {
}, },
{ {
id: 'sidebarText', id: 'sidebarText',
uiName: 'Sidebar text color' uiName: 'Sidebar Text'
}, },
{ {
id: 'sidebarHeaderBg', id: 'sidebarHeaderBg',
@@ -190,51 +218,55 @@ module.exports = {
}, },
{ {
id: 'sidebarHeaderTextColor', id: 'sidebarHeaderTextColor',
uiName: 'Sidebar Header text color' uiName: 'Sidebar Header Text'
}, },
{ {
id: 'sidebarUnreadText', id: 'sidebarUnreadText',
uiName: 'Sidebar unread text color' uiName: 'Sidebar Unread Text'
}, },
{ {
id: 'sidebarTextHoverBg', id: 'sidebarTextHoverBg',
uiName: 'Sidebar text hover BG' uiName: 'Sidebar Text Hover BG'
}, },
{ {
id: 'sidebarTextHoverColor', id: 'sidebarTextHoverColor',
uiName: 'Sidebar text hover color' uiName: 'Sidebar Text Hover Color'
}, },
{ {
id: 'sidebarTextActiveBg', id: 'sidebarTextActiveBg',
uiName: 'Sidebar text active BG' uiName: 'Sidebar Text Active BG'
}, },
{ {
id: 'sidebarTextActiveColor', id: 'sidebarTextActiveColor',
uiName: 'Sidebar text active color' uiName: 'Sidebar Text Active Color'
}, },
{ {
id: 'onlineIndicator', id: 'onlineIndicator',
uiName: 'Online indicator' uiName: 'Online Indicator'
}, },
{ {
id: 'mentionBj', id: 'mentionBj',
uiName: 'Mention jewel BG' uiName: 'Mention Jewel BG'
}, },
{ {
id: 'mentionColor', id: 'mentionColor',
uiName: 'Mention jewel text color' uiName: 'Mention Jewel Text'
}, },
{ {
id: 'centerChannelBg', id: 'centerChannelBg',
uiName: 'Center channel BG' uiName: 'Center Channel BG'
}, },
{ {
id: 'centerChannelColor', id: 'centerChannelColor',
uiName: 'Center channel text color' uiName: 'Center Channel Text'
},
{
id: 'newMessageSeparator',
uiName: 'New message separator'
}, },
{ {
id: 'linkColor', id: 'linkColor',
uiName: 'Link color' uiName: 'Link Color'
}, },
{ {
id: 'buttonBg', id: 'buttonBg',
@@ -243,7 +275,7 @@ module.exports = {
{ {
id: 'buttonColor', id: 'buttonColor',
uiName: 'Button Color' uiName: 'Button Text'
} }
] ]
}; };

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

@@ -5,15 +5,14 @@ const emoticonPatterns = {
smile: /:-?\)/g, // :) smile: /:-?\)/g, // :)
open_mouth: /:o/gi, // :o open_mouth: /:o/gi, // :o
scream: /:-o/gi, // :-o scream: /:-o/gi, // :-o
smirk: /[:;]-?]/g, // :] smirk: /:-?]/g, // :]
grinning: /[:;]-?d/gi, // :D grinning: /:-?d/gi, // :D
stuck_out_tongue_closed_eyes: /x-d/gi, // x-d stuck_out_tongue_closed_eyes: /x-d/gi, // x-d
stuck_out_tongue_winking_eye: /[:;]-?p/gi, // ;p stuck_out_tongue_winking_eye: /:-?p/gi, // :p
rage: /:-?[\[@]/g, // :@ rage: /:-?[\[@]/g, // :@
frowning: /:-?\(/g, // :( frowning: /:-?\(/g, // :(
sob: /:[']-?\(|:&#x27;\(/g, // :`( sob: /:[']-?\(|:&#x27;\(/g, // :`(
kissing_heart: /:-?\*/g, // :* kissing_heart: /:-?\*/g, // :*
wink: /;-?\)/g, // ;)
pensive: /:-?\//g, // :/ pensive: /:-?\//g, // :/
confounded: /:-?s/gi, // :s confounded: /:-?s/gi, // :s
flushed: /:-?\|/g, // :| flushed: /:-?\|/g, // :|

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

@@ -15,6 +15,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
this.formattingOptions = formattingOptions; this.formattingOptions = formattingOptions;
} }
br() {
if (this.formattingOptions.singleline) {
return ' ';
}
return super.br();
}
heading(text, level, raw) { heading(text, level, raw) {
const id = `${this.options.headerPrefix}${raw.toLowerCase().replace(/[^\w]+/g, '-')}`; const id = `${this.options.headerPrefix}${raw.toLowerCase().replace(/[^\w]+/g, '-')}`;
return `<h${level} id="${id}" class="markdown__heading">${text}</h${level}>`; return `<h${level} id="${id}" class="markdown__heading">${text}</h${level}>`;
@@ -36,6 +44,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
return output; return output;
} }
paragraph(text) {
if (this.formattingOptions.singleline) {
return `<p class="markdown__paragraph-inline">${text}</p>`;
}
return super.paragraph(text);
}
table(header, body) { table(header, body) {
return `<table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table>`; return `<table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table>`;
} }

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

@@ -4,6 +4,7 @@
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
var ChannelStore = require('../stores/channel_store.jsx'); var ChannelStore = require('../stores/channel_store.jsx');
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
var TeamStore = require('../stores/team_store.jsx');
var Constants = require('../utils/constants.jsx'); var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes; var ActionTypes = Constants.ActionTypes;
var AsyncClient = require('./async_client.jsx'); var AsyncClient = require('./async_client.jsx');
@@ -113,7 +114,7 @@ export function notifyMe(title, body, channel) {
if (channel) { if (channel) {
switchChannel(channel); switchChannel(channel);
} else { } else {
window.location.href = '/'; window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square';
} }
}; };
setTimeout(function closeNotificationOnTimeout() { setTimeout(function closeNotificationOnTimeout() {
@@ -314,7 +315,6 @@ function getYoutubeEmbed(link) {
$('.video-type.' + youtubeId).html('Youtube - '); $('.video-type.' + youtubeId).html('Youtube - ');
$('.video-uploader.' + youtubeId).html(metadata.channelTitle); $('.video-uploader.' + youtubeId).html(metadata.channelTitle);
$('.video-title.' + youtubeId).find('a').html(metadata.title); $('.video-title.' + youtubeId).find('a').html(metadata.title);
$('.post-list-holder-by-time').scrollTop($('.post-list-holder-by-time')[0].scrollHeight);
} }
if (global.window.config.GoogleDeveloperKey) { if (global.window.config.GoogleDeveloperKey) {
@@ -553,7 +553,6 @@ export function applyTheme(theme) {
changeCss('.sidebar--left .nav li>h4, .sidebar--left .add-channel-btn', 'color:' + changeOpacity(theme.sidebarText, 0.8), 1); changeCss('.sidebar--left .nav li>h4, .sidebar--left .add-channel-btn', 'color:' + changeOpacity(theme.sidebarText, 0.8), 1);
changeCss('.sidebar--left .add-channel-btn:hover, .sidebar--left .add-channel-btn:focus', 'color:' + theme.sidebarText, 1); changeCss('.sidebar--left .add-channel-btn:hover, .sidebar--left .add-channel-btn:focus', 'color:' + theme.sidebarText, 1);
changeCss('.sidebar--left, .sidebar--right .sidebar--right__header', 'border-color:' + changeOpacity(theme.sidebarText, 0.2), 1); changeCss('.sidebar--left, .sidebar--right .sidebar--right__header', 'border-color:' + changeOpacity(theme.sidebarText, 0.2), 1);
changeCss('.sidebar--right .sidebar-right__body', 'border-color:' + changeOpacity(theme.sidebarText, 0.2), 2);
changeCss('.sidebar--left .status path', 'fill:' + changeOpacity(theme.sidebarText, 0.5), 1); changeCss('.sidebar--left .status path', 'fill:' + changeOpacity(theme.sidebarText, 0.5), 1);
} }
@@ -607,29 +606,37 @@ export function applyTheme(theme) {
} }
if (theme.centerChannelBg) { if (theme.centerChannelBg) {
changeCss('.app__content', 'background:' + theme.centerChannelBg, 1); changeCss('.app__content, .markdown__table, .markdown__table tbody tr', 'background:' + theme.centerChannelBg, 1);
changeCss('#post-list .post-list-holder-by-time', 'background:' + theme.centerChannelBg, 1); changeCss('#post-list .post-list-holder-by-time', 'background:' + theme.centerChannelBg, 1);
changeCss('#post-create', 'background:' + theme.centerChannelBg, 1); changeCss('#post-create', 'background:' + theme.centerChannelBg, 1);
changeCss('.search-bar__container .search__form .search-bar', 'background:' + theme.centerChannelBg, 1); changeCss('.search-bar__container .search__form .search-bar', 'background:' + theme.centerChannelBg, 1);
changeCss('.date-separator .separator__text, .new-separator .separator__text', 'background:' + theme.centerChannelBg, 1); changeCss('.date-separator .separator__text, .new-separator .separator__text', 'background:' + theme.centerChannelBg, 1);
changeCss('.post-image__column .post-image__details', 'background:' + theme.centerChannelBg, 1);
changeCss('.sidebar--right', 'background:' + theme.centerChannelBg, 1); changeCss('.sidebar--right', 'background:' + theme.centerChannelBg, 1);
} }
if (theme.centerChannelColor) { if (theme.centerChannelColor) {
changeCss('.app__content', 'color:' + theme.centerChannelColor, 2); changeCss('.app__content, .post-create__container .post-create-body .btn-file, .post-create__container .post-create-footer .msg-typing, .loading-screen .loading__content .round', 'color:' + theme.centerChannelColor, 1);
changeCss('#post-create', 'color:' + theme.centerChannelColor, 2); changeCss('#post-create', 'color:' + theme.centerChannelColor, 2);
changeCss('.post-body hr', 'background:' + theme.centerChannelColor, 1);
changeCss('.channel-header .heading', 'color:' + theme.centerChannelColor, 1); changeCss('.channel-header .heading', 'color:' + theme.centerChannelColor, 1);
changeCss('.markdown__table tbody tr:nth-child(2n)', 'background:' + changeOpacity(theme.centerChannelColor, 0.07), 1);
changeCss('.channel-header__info>div.dropdown .header-dropdown__icon', 'color:' + changeOpacity(theme.centerChannelColor, 0.8), 1); changeCss('.channel-header__info>div.dropdown .header-dropdown__icon', 'color:' + changeOpacity(theme.centerChannelColor, 0.8), 1);
changeCss('.channel-header #member_popover', 'color:' + changeOpacity(theme.centerChannelColor, 0.8), 1); changeCss('.channel-header #member_popover', 'color:' + changeOpacity(theme.centerChannelColor, 0.8), 1);
changeCss('.custom-textarea', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2) + '!important; color: ' + theme.centerChannelColor, 1); changeCss('.custom-textarea, .custom-textarea:focus, .preview-container .preview-div, .post-image__column .post-image__details, .sidebar--right .sidebar-right__body, .markdown__table th, .markdown__table td', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1);
changeCss('.custom-textarea', 'color:' + theme.centerChannelColor, 1);
changeCss('.post-image__column', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 2);
changeCss('.post-image__column .post-image__details', 'color:' + theme.centerChannelColor, 2);
changeCss('.post-image__column a, .post-image__column a:hover, .post-image__column a:focus', 'color:' + theme.centerChannelColor, 1);
changeCss('.search-bar__container .search__form .search-bar', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2) + '; color: ' + theme.centerChannelColor, 2); changeCss('.search-bar__container .search__form .search-bar', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2) + '; color: ' + theme.centerChannelColor, 2);
changeCss('.search-bar__container .search__form', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1); changeCss('.search-bar__container .search__form', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1);
changeCss('.channel-intro .channel-intro__content', 'background:' + changeOpacity(theme.centerChannelColor, 0.05), 1); changeCss('.channel-intro .channel-intro__content', 'background:' + changeOpacity(theme.centerChannelColor, 0.05), 1);
changeCss('.date-separator .separator__text, .new-separator .separator__text', 'color:' + theme.centerChannelColor, 2); changeCss('.date-separator .separator__text', 'color:' + theme.centerChannelColor, 2);
changeCss('.date-separator .separator__hr, .new-separator .separator__hr, .post-right__container .post.post--root hr, .search-item-container', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1); changeCss('.date-separator .separator__hr, .post-right__container .post.post--root hr, .search-item-container', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1);
changeCss('.channel-intro', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1); changeCss('.channel-intro', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.2), 1);
changeCss('.post.current--user .post-body, .post.post--comment.other--root.current--user .post-comment', 'background:' + changeOpacity(theme.centerChannelColor, 0.07), 1); changeCss('.post.current--user .post-body, .post.post--comment.other--root.current--user .post-comment', 'background:' + changeOpacity(theme.centerChannelColor, 0.07), 1);
changeCss('.post.current--user .post-body, .post.post--comment.other--root.current--user .post-comment', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2); changeCss('.post.current--user .post-body, .post.post--comment.other--root.current--user .post-comment, .post.post--comment.other--root .post-comment, .post.same--root .post-body', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2);
changeCss('@media(max-width: 1440px){.post.same--root', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2);
changeCss('@media(max-width: 1440px){.post.same--root', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2); changeCss('@media(max-width: 1440px){.post.same--root', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2);
changeCss('@media(max-width: 1800px){.inner__wrap.move--left .post.post--comment.same--root', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2); changeCss('@media(max-width: 1800px){.inner__wrap.move--left .post.post--comment.same--root', 'border-color:' + changeOpacity(theme.centerChannelColor, 0.07), 2);
changeCss('.post:hover, .sidebar--right .sidebar--right__header', 'background:' + changeOpacity(theme.centerChannelColor, 0.07), 1); changeCss('.post:hover, .sidebar--right .sidebar--right__header', 'background:' + changeOpacity(theme.centerChannelColor, 0.07), 1);
@@ -639,6 +646,11 @@ export function applyTheme(theme) {
changeCss('.sidebar--right', 'color:' + theme.centerChannelColor, 2); changeCss('.sidebar--right', 'color:' + theme.centerChannelColor, 2);
} }
if (theme.newMessageSeparator) {
changeCss('.new-separator .separator__text', 'color:' + theme.newMessageSeparator, 1);
changeCss('.new-separator .separator__hr', 'border-color:' + changeOpacity(theme.newMessageSeparator, 0.5), 1);
}
if (theme.linkColor) { if (theme.linkColor) {
changeCss('a, a:focus, a:hover', 'color:' + theme.linkColor, 1); changeCss('a, a:focus, a:hover', 'color:' + theme.linkColor, 1);
changeCss('.post .comment-icon__container', 'fill:' + theme.linkColor, 1); changeCss('.post .comment-icon__container', 'fill:' + theme.linkColor, 1);

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

@@ -1,5 +1,5 @@
.sidebar--left {
&.sidebar--collapsable { .sidebar--left { &.sidebar--collapsable {
background: #333; background: #333;
.team__header { .team__header {
background: transparent; background: transparent;
@@ -9,7 +9,7 @@
li { li {
padding: 0; padding: 0;
.icon { .icon {
width: 15px; width: 17px;
} }
> a { > a {
color: #fff; color: #fff;
@@ -19,6 +19,11 @@
background-color: $primary-color; background-color: $primary-color;
} }
} }
> h4 {
background: #333;
padding: 10px 10px;
margin: 1px 0 0;
}
} }
.menu-icon--right { .menu-icon--right {
vertical-align: top; vertical-align: top;
@@ -29,12 +34,15 @@
font-size: 13px; font-size: 13px;
right: -2px; right: -2px;
position: relative; position: relative;
color: #fff;
} }
} }
&.nav__sub-menu { &.nav__sub-menu {
padding: 5px 0;
background: #111; background: #111;
-webkit-font-smoothing: auto; -webkit-font-smoothing: auto;
&.padded {
padding: 5px 0;
}
li { li {
> a { > a {
font-size: 13px; font-size: 13px;
@@ -88,6 +96,7 @@
overflow: auto; overflow: auto;
background-color: #f1f1f1; background-color: #f1f1f1;
padding: 0 20px 20px; padding: 0 20px 20px;
min-height: 600px;
} }
.wrapper--fixed { .wrapper--fixed {
max-width: 800px; max-width: 800px;

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

@@ -34,8 +34,18 @@ body {
} }
} }
b, strong { .popover {
font-weight: 600; color: #333;
a {
color: $primary-color;
&:hover, &:focus {
color: $primary-color;
}
}
}
.word-break--all {
word-break: break-all;
} }
a { a {

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

@@ -157,23 +157,23 @@
border-left: 1px solid #ddd; border-left: 1px solid #ddd;
font-size: 13px; font-size: 13px;
padding: 7px; padding: 7px;
color: #333;
.post-image__name { .post-image__name {
margin-bottom: 3px; margin-bottom: 3px;
display: block; display: block;
color: #333;
} }
.post-image__download { .post-image__download {
display: inline-block; display: inline-block;
padding-right: 7px; padding-right: 7px;
cursor: pointer; cursor: pointer;
color: #555; @include opacity(0.7);
} }
.post-image__type { .post-image__type {
color: grey; @include opacity(0.6);
} }
.post-image__size { .post-image__size {
margin-left: 4px; margin-left: 4px;
color: grey; @include opacity(0.6);
} }
} }
a { a {
@@ -214,4 +214,3 @@
} }
} }
} }

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

@@ -37,4 +37,4 @@
to { opacity: 0.1; } to { opacity: 0.1; }
} }
} }
} }

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

@@ -1,5 +1,21 @@
.markdown__heading { .markdown__heading {
font-weight: bold; font-weight: 700;
}
.markdown__paragraph-inline {
display: inline;
+ .markdown__paragraph-inline {
margin-left: 4px;
}
}
.post-body {
hr {
height: 4px;
padding: 0;
margin: 15px 0 16px;
background-color: #e7e7e7;
border: 0 none;
@include opacity(0.2);
}
} }
.markdown__table { .markdown__table {
background: #fff; background: #fff;
@@ -15,6 +31,26 @@
} }
} }
} }
blockquote {
border: none;
position: relative;
font-size: 16px;
padding: 10px 10px 10px 38px;
margin-bottom: 0;
&:before {
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
display: inline-block;
text-decoration: inherit;
content: "\f10d";
left: 8px;
top: 5px;
position: absolute;
font-size: 20px;
@include opacity(0.6);
}
}
pre { pre {
border: none; border: none;
background-color: #f7f7f7; background-color: #f7f7f7;
@@ -25,4 +61,7 @@ pre {
code { code {
color: #c7254e; color: #c7254e;
} }
} }
code {
background: #fff;
}

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

@@ -63,10 +63,11 @@
padding-left: 10px; padding-left: 10px;
} }
.mention-highlight { .mention-link {
background-color:#fff2bb; color: $primary-color;
} }
.mention-link { .mention-highlight {
color:$primary-color; background-color:#fff2bb;
color: #333;
} }

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

@@ -3,6 +3,7 @@
} }
.modal { .modal {
width: 100%; width: 100%;
color: #333;
&.image_modal { &.image_modal {
.modal-backdrop.in { .modal-backdrop.in {
@include opacity(0.7); @include opacity(0.7);
@@ -10,12 +11,26 @@
} }
a, a:focus, a:hover { a, a:focus, a:hover {
color: #2389D7; color: #2389D7;
&.text-danger {
color: #a94442;
}
} }
.btn.btn-primary { .custom-textarea {
background: #4285f4; color: inherit;
&:hover, &:focus, &:active { border-color: #ccc;
background: $primary-color--hover; &:focus {
color: #fff; border-color: #ccc;
box-shadow: none;
}
}
.btn {
font-size: 13px;
&.btn-primary {
background: #4285f4;
&:hover, &:focus, &:active {
background: $primary-color--hover;
color: #fff;
}
} }
} }
.info__label { .info__label {
@@ -181,16 +196,13 @@
position: relative; position: relative;
max-width: 90%; max-width: 90%;
min-height: 100px; min-height: 100px;
min-width: 320px; min-width: 240px;
@include border-radius(3px); @include border-radius(3px);
display: table; display: table;
margin: 0 auto; margin: 0 auto;
&:hover { &:hover {
@include border-radius(3px 3px 0 0); @include border-radius(3px 3px 0 0);
} }
&:hover .modal-close {
@include opacity(1);
}
&.default { &.default {
width: 100%; width: 100%;
height: 80%; height: 80%;
@@ -204,8 +216,15 @@
right: -13px; right: -13px;
top: -13px; top: -13px;
@include opacity(0); @include opacity(0);
-webkit-transition: opacity 0.6s;
-moz-transition: opacity 0.6s;
-o-transition: opacity 0.6s;
transition: opacity 0.6s;
cursor: pointer; cursor: pointer;
z-index: 9999; z-index: 9999;
&.modal-close--show {
@include opacity(1);
}
} }
> a { > a {
background: #FFF; background: #FFF;
@@ -217,7 +236,7 @@
max-height: 100%; max-height: 100%;
} }
} }
.image-content { .modal-content{
box-shadow: none; box-shadow: none;
background: rgba(0, 0, 0, 0); background: rgba(0, 0, 0, 0);
width: 100%; width: 100%;
@@ -301,6 +320,7 @@
} }
} }
// Invite New Member // Invite New Member
.invite { .invite {
margin-right: 40px; margin-right: 40px;
@@ -315,4 +335,4 @@
padding-left: 0; padding-left: 0;
} }
} }
} }

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

@@ -2,13 +2,17 @@
white-space:pre-wrap; white-space:pre-wrap;
word-wrap:break-word; word-wrap:break-word;
background:transparent; background:transparent;
border:1px solid #ccc !important; border:1px solid #ccc;
position:absolute; position:absolute;
top:0px; top:0px;
height:auto; height:auto;
resize: none; resize: none;
line-height:20px; line-height:20px;
min-height:36px; min-height:36px;
&:focus {
border-color: #ccc;
box-shadow: none;
}
} }
.bad-connection { .bad-connection {
@@ -225,17 +229,17 @@ body.ios {
right: 0; right: 0;
position: absolute; position: absolute;
top: 1px; top: 1px;
color: #999; color: #444;
@include opacity(0.5);
@include single-transition(all, 0.15s); @include single-transition(all, 0.15s);
font-size: 16px; font-size: 16px;
padding: 7px 9px 6px; padding: 7px 9px 6px;
&:hover, &:active { &:hover, &:active {
color: #444; @include opacity(0.9);
box-shadow: none; box-shadow: none;
} }
} }
textarea { textarea {
border: none;
box-shadow: none; box-shadow: none;
} }
} }
@@ -253,7 +257,7 @@ body.ios {
line-height: 18px; line-height: 18px;
display: inline-block; display: inline-block;
font-size: 13px; font-size: 13px;
color: #777; @include opacity(0.6);
} }
} }
} }

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше