summaryrefslogtreecommitdiffstats
path: root/mattermost.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-02-23 09:48:07 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-02-23 09:48:07 -0500
commit5d4fd8407edfc476296a7b6ed28da581b989b264 (patch)
tree56d6ef6f6d4876c2835bbd7aa916caf31caf846e /mattermost.go
parent490e64352536336548ecbaea5f1ba1c0209fe2f7 (diff)
parent29c5bd9def46a835a2d19988c861402cb54d0f1c (diff)
downloadchat-5d4fd8407edfc476296a7b6ed28da581b989b264.tar.gz
chat-5d4fd8407edfc476296a7b6ed28da581b989b264.tar.bz2
chat-5d4fd8407edfc476296a7b6ed28da581b989b264.zip
Merge pull request #2216 from mattermost/fix-cmds
Fixing localization error in commands
Diffstat (limited to 'mattermost.go')
-rw-r--r--mattermost.go29
1 files changed, 13 insertions, 16 deletions
diff --git a/mattermost.go b/mattermost.go
index 5a18e2f40..ca7d43df7 100644
--- a/mattermost.go
+++ b/mattermost.go
@@ -276,9 +276,7 @@ func cmdCreateTeam() {
os.Exit(1)
}
- c := &api.Context{}
- c.RequestId = model.NewId()
- c.IpAddress = "cmd_line"
+ c := getMockContext()
team := &model.Team{}
team.DisplayName = flagTeamName
@@ -377,9 +375,7 @@ func cmdAssignRole() {
os.Exit(1)
}
- c := &api.Context{}
- c.RequestId = model.NewId()
- c.IpAddress = "cmd_line"
+ c := getMockContext()
var team *model.Team
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil {
@@ -431,10 +427,6 @@ func cmdResetPassword() {
os.Exit(1)
}
- c := &api.Context{}
- c.RequestId = model.NewId()
- c.IpAddress = "cmd_line"
-
var team *model.Team
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil {
l4g.Error("%v", result.Err)
@@ -474,9 +466,7 @@ func cmdPermDeleteUser() {
os.Exit(1)
}
- c := &api.Context{}
- c.RequestId = model.NewId()
- c.IpAddress = "cmd_line"
+ c := getMockContext()
var team *model.Team
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil {
@@ -525,9 +515,7 @@ func cmdPermDeleteTeam() {
os.Exit(1)
}
- c := &api.Context{}
- c.RequestId = model.NewId()
- c.IpAddress = "cmd_line"
+ c := getMockContext()
var team *model.Team
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil {
@@ -566,6 +554,15 @@ func flushLogAndExit(code int) {
os.Exit(code)
}
+func getMockContext() *api.Context {
+ c := &api.Context{}
+ c.RequestId = model.NewId()
+ c.IpAddress = "cmd_line"
+ c.T = utils.TfuncWithFallback(model.DEFAULT_LOCALE)
+ c.Locale = model.DEFAULT_LOCALE
+ return c
+}
+
var usage = `Mattermost commands to help configure the system
NAME: