Commit 5b2ec623 authored by =Corey Hulen's avatar =Corey Hulen

PLT-7 adding loc db calls for team table

parent ca33812c
...@@ -387,7 +387,7 @@ func (c *Context) setTeamURL(url string, valid bool) { ...@@ -387,7 +387,7 @@ func (c *Context) setTeamURL(url string, valid bool) {
} }
func (c *Context) SetTeamURLFromSession() { func (c *Context) SetTeamURLFromSession() {
if result := <-Srv.Store.Team().Get(c.Session.TeamId); result.Err == nil { if result := <-Srv.Store.Team().Get(c.T, c.Session.TeamId); result.Err == nil {
c.setTeamURL(c.GetSiteURL()+"/"+result.Data.(*model.Team).Name, true) c.setTeamURL(c.GetSiteURL()+"/"+result.Data.(*model.Team).Name, true)
} }
} }
......
...@@ -6,10 +6,12 @@ package api ...@@ -6,10 +6,12 @@ package api
import ( import (
"archive/zip" "archive/zip"
"encoding/json" "encoding/json"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
"io" "io"
"os" "os"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
goi18n "github.com/nicksnyder/go-i18n/i18n"
) )
const ( const (
...@@ -51,19 +53,19 @@ func ExportOptionsFromJson(data io.Reader) *ExportOptions { ...@@ -51,19 +53,19 @@ func ExportOptionsFromJson(data io.Reader) *ExportOptions {
return &o return &o
} }
func ExportToFile(options *ExportOptions) (link string, err *model.AppError) { func ExportToFile(T goi18n.TranslateFunc, options *ExportOptions) (link string, err *model.AppError) {
// Open file for export // Open file for export
if file, err := openFileWriteStream(EXPORT_PATH + EXPORT_FILENAME); err != nil { if file, err := openFileWriteStream(EXPORT_PATH + EXPORT_FILENAME); err != nil {
return "", err return "", err
} else { } else {
defer closeFileWriteStream(file) defer closeFileWriteStream(file)
ExportToWriter(file, options) ExportToWriter(T, file, options)
} }
return "/api/v1/files/get_export", nil return "/api/v1/files/get_export", nil
} }
func ExportToWriter(w io.Writer, options *ExportOptions) *model.AppError { func ExportToWriter(T goi18n.TranslateFunc, w io.Writer, options *ExportOptions) *model.AppError {
// Open a writer to write to zip file // Open a writer to write to zip file
zipWriter := zip.NewWriter(w) zipWriter := zip.NewWriter(w)
defer zipWriter.Close() defer zipWriter.Close()
...@@ -78,23 +80,23 @@ func ExportToWriter(w io.Writer, options *ExportOptions) *model.AppError { ...@@ -78,23 +80,23 @@ func ExportToWriter(w io.Writer, options *ExportOptions) *model.AppError {
} }
// Export Teams // Export Teams
ExportTeams(zipWriter, options) ExportTeams(T, zipWriter, options)
return nil return nil
} }
func ExportTeams(writer ExportWriter, options *ExportOptions) *model.AppError { func ExportTeams(T goi18n.TranslateFunc, 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().GetAll(); result.Err != nil { if result := <-Srv.Store.Team().GetAll(T); result.Err != nil {
return result.Err return result.Err
} else { } else {
teams = result.Data.([]*model.Team) teams = result.Data.([]*model.Team)
} }
} else { } else {
for _, teamId := range options.TeamsToExport { for _, teamId := range options.TeamsToExport {
if result := <-Srv.Store.Team().Get(teamId); result.Err != nil { if result := <-Srv.Store.Team().Get(T, teamId); result.Err != nil {
return result.Err return result.Err
} else { } else {
team := result.Data.(*model.Team) team := result.Data.(*model.Team)
......
...@@ -205,7 +205,7 @@ func CreateWebhookPost(c *Context, channelId, text, overrideUsername, overrideIc ...@@ -205,7 +205,7 @@ func CreateWebhookPost(c *Context, channelId, text, overrideUsername, overrideIc
func handlePostEventsAndForget(c *Context, post *model.Post, triggerWebhooks bool) { func handlePostEventsAndForget(c *Context, post *model.Post, triggerWebhooks bool) {
go func() { go func() {
tchan := Srv.Store.Team().Get(c.Session.TeamId) tchan := Srv.Store.Team().Get(c.T, c.Session.TeamId)
cchan := Srv.Store.Channel().Get(post.ChannelId) cchan := Srv.Store.Channel().Get(post.ChannelId)
uchan := Srv.Store.User().Get(post.UserId) uchan := Srv.Store.User().Get(post.UserId)
......
...@@ -128,7 +128,7 @@ func createTeamFromSSO(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -128,7 +128,7 @@ func createTeamFromSSO(c *Context, w http.ResponseWriter, r *http.Request) {
} }
} }
if result := <-Srv.Store.Team().Save(team); result.Err != nil { if result := <-Srv.Store.Team().Save(c.T, team); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
...@@ -209,7 +209,7 @@ func createTeamFromSignup(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -209,7 +209,7 @@ func createTeamFromSignup(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if result := <-Srv.Store.Team().Save(&teamSignup.Team); result.Err != nil { if result := <-Srv.Store.Team().Save(c.T, &teamSignup.Team); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
...@@ -264,7 +264,7 @@ func CreateTeam(c *Context, team *model.Team) *model.Team { ...@@ -264,7 +264,7 @@ func CreateTeam(c *Context, team *model.Team) *model.Team {
return nil return nil
} }
if result := <-Srv.Store.Team().Save(team); result.Err != nil { if result := <-Srv.Store.Team().Save(c.T, team); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return nil return nil
} else { } else {
...@@ -313,7 +313,7 @@ func getAll(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -313,7 +313,7 @@ func getAll(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if result := <-Srv.Store.Team().GetAll(); result.Err != nil { if result := <-Srv.Store.Team().GetAll(c.T); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
...@@ -382,7 +382,7 @@ func FindTeamByName(c *Context, name string, all string) bool { ...@@ -382,7 +382,7 @@ func FindTeamByName(c *Context, name string, all string) bool {
return false return false
} }
if result := <-Srv.Store.Team().GetByName(name); result.Err != nil { if result := <-Srv.Store.Team().GetByName(c.T, name); result.Err != nil {
return false return false
} else { } else {
return true return true
...@@ -402,7 +402,7 @@ func findTeams(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -402,7 +402,7 @@ func findTeams(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if result := <-Srv.Store.Team().GetTeamsForEmail(email); result.Err != nil { if result := <-Srv.Store.Team().GetTeamsForEmail(c.T, email); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
...@@ -433,7 +433,7 @@ func emailTeams(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -433,7 +433,7 @@ func emailTeams(c *Context, w http.ResponseWriter, r *http.Request) {
bodyPage := NewServerTemplatePage("find_teams_body") bodyPage := NewServerTemplatePage("find_teams_body")
bodyPage.ClientCfg["SiteURL"] = c.GetSiteURL() bodyPage.ClientCfg["SiteURL"] = c.GetSiteURL()
if result := <-Srv.Store.Team().GetTeamsForEmail(email); result.Err != nil { if result := <-Srv.Store.Team().GetTeamsForEmail(c.T, email); result.Err != nil {
c.Err = result.Err c.Err = result.Err
} else { } else {
teams := result.Data.([]*model.Team) teams := result.Data.([]*model.Team)
...@@ -461,7 +461,7 @@ func inviteMembers(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -461,7 +461,7 @@ func inviteMembers(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
tchan := Srv.Store.Team().Get(c.Session.TeamId) tchan := Srv.Store.Team().Get(c.T, c.Session.TeamId)
uchan := Srv.Store.User().Get(c.Session.UserId) uchan := Srv.Store.User().Get(c.Session.UserId)
var team *model.Team var team *model.Team
...@@ -561,7 +561,7 @@ func updateTeam(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -561,7 +561,7 @@ func updateTeam(c *Context, w http.ResponseWriter, r *http.Request) {
} }
var oldTeam *model.Team var oldTeam *model.Team
if result := <-Srv.Store.Team().Get(team.Id); result.Err != nil { if result := <-Srv.Store.Team().Get(c.T, team.Id); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
...@@ -576,7 +576,7 @@ func updateTeam(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -576,7 +576,7 @@ func updateTeam(c *Context, w http.ResponseWriter, r *http.Request) {
oldTeam.AllowedDomains = team.AllowedDomains oldTeam.AllowedDomains = team.AllowedDomains
//oldTeam.Type = team.Type //oldTeam.Type = team.Type
if result := <-Srv.Store.Team().Update(oldTeam); result.Err != nil { if result := <-Srv.Store.Team().Update(c.T, oldTeam); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} }
...@@ -592,7 +592,7 @@ func PermanentDeleteTeam(c *Context, team *model.Team) *model.AppError { ...@@ -592,7 +592,7 @@ func PermanentDeleteTeam(c *Context, team *model.Team) *model.AppError {
c.LogAuditWithUserId("", fmt.Sprintf("attempt teamId=%v", team.Id)) c.LogAuditWithUserId("", fmt.Sprintf("attempt teamId=%v", team.Id))
team.DeleteAt = model.GetMillis() team.DeleteAt = model.GetMillis()
if result := <-Srv.Store.Team().Update(team); result.Err != nil { if result := <-Srv.Store.Team().Update(c.T, team); result.Err != nil {
return result.Err return result.Err
} }
...@@ -609,7 +609,7 @@ func PermanentDeleteTeam(c *Context, team *model.Team) *model.AppError { ...@@ -609,7 +609,7 @@ func PermanentDeleteTeam(c *Context, team *model.Team) *model.AppError {
return result.Err return result.Err
} }
if result := <-Srv.Store.Team().PermanentDelete(team.Id); result.Err != nil { if result := <-Srv.Store.Team().PermanentDelete(c.T, team.Id); result.Err != nil {
return result.Err return result.Err
} }
...@@ -625,7 +625,7 @@ func getMyTeam(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -625,7 +625,7 @@ func getMyTeam(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if result := <-Srv.Store.Team().Get(c.Session.TeamId); result.Err != nil { if result := <-Srv.Store.Team().Get(c.T, c.Session.TeamId); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else if HandleEtag(result.Data.(*model.Team).Etag(), w, r) { } else if HandleEtag(result.Data.(*model.Team).Etag(), w, r) {
...@@ -714,7 +714,7 @@ func exportTeam(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -714,7 +714,7 @@ func exportTeam(c *Context, w http.ResponseWriter, r *http.Request) {
options := ExportOptionsFromJson(r.Body) options := ExportOptionsFromJson(r.Body)
if link, err := ExportToFile(options); err != nil { if link, err := ExportToFile(c.T, options); err != nil {
c.Err = err c.Err = err
return return
} else { } else {
......
...@@ -84,7 +84,7 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -84,7 +84,7 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
var team *model.Team var team *model.Team
if result := <-Srv.Store.Team().Get(user.TeamId); result.Err != nil { if result := <-Srv.Store.Team().Get(c.T, user.TeamId); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
...@@ -264,7 +264,7 @@ func CreateOAuthUser(c *Context, w http.ResponseWriter, r *http.Request, service ...@@ -264,7 +264,7 @@ func CreateOAuthUser(c *Context, w http.ResponseWriter, r *http.Request, service
if team.Email == "" { if team.Email == "" {
team.Email = user.Email team.Email = user.Email
if result := <-Srv.Store.Team().Update(team); result.Err != nil { if result := <-Srv.Store.Team().Update(c.T, team); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return nil return nil
} }
...@@ -404,7 +404,7 @@ func LoginById(c *Context, w http.ResponseWriter, r *http.Request, userId, passw ...@@ -404,7 +404,7 @@ func LoginById(c *Context, w http.ResponseWriter, r *http.Request, userId, passw
func LoginByEmail(c *Context, w http.ResponseWriter, r *http.Request, email, name, password, deviceId string) *model.User { func LoginByEmail(c *Context, w http.ResponseWriter, r *http.Request, email, name, password, deviceId string) *model.User {
var team *model.Team var team *model.Team
if result := <-Srv.Store.Team().GetByName(name); result.Err != nil { if result := <-Srv.Store.Team().GetByName(c.T, name); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return nil return nil
} else { } else {
...@@ -659,7 +659,7 @@ func loginLdap(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -659,7 +659,7 @@ func loginLdap(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
teamc := Srv.Store.Team().GetByName(teamName) teamc := Srv.Store.Team().GetByName(c.T, teamName)
ldapInterface := einterfaces.GetLdapInterface() ldapInterface := einterfaces.GetLdapInterface()
if ldapInterface == nil { if ldapInterface == nil {
...@@ -1134,7 +1134,7 @@ func updateUser(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -1134,7 +1134,7 @@ func updateUser(c *Context, w http.ResponseWriter, r *http.Request) {
rusers := result.Data.([2]*model.User) rusers := result.Data.([2]*model.User)
if rusers[0].Email != rusers[1].Email { if rusers[0].Email != rusers[1].Email {
if tresult := <-Srv.Store.Team().Get(rusers[1].TeamId); tresult.Err != nil { if tresult := <-Srv.Store.Team().Get(c.T, rusers[1].TeamId); tresult.Err != nil {
l4g.Error(tresult.Err.Message) l4g.Error(tresult.Err.Message)
} else { } else {
team := tresult.Data.(*model.Team) team := tresult.Data.(*model.Team)
...@@ -1195,7 +1195,7 @@ func updatePassword(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -1195,7 +1195,7 @@ func updatePassword(c *Context, w http.ResponseWriter, r *http.Request) {
user := result.Data.(*model.User) user := result.Data.(*model.User)
tchan := Srv.Store.Team().Get(user.TeamId) tchan := Srv.Store.Team().Get(c.T, user.TeamId)
if user.AuthData != "" { if user.AuthData != "" {
c.LogAudit("failed - tried to update user password who was logged in through oauth") c.LogAudit("failed - tried to update user password who was logged in through oauth")
...@@ -1494,7 +1494,7 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -1494,7 +1494,7 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) {
} }
var team *model.Team var team *model.Team
if result := <-Srv.Store.Team().GetByName(name); result.Err != nil { if result := <-Srv.Store.Team().GetByName(c.T, name); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
...@@ -1583,7 +1583,7 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -1583,7 +1583,7 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAuditWithUserId(userId, "attempt") c.LogAuditWithUserId(userId, "attempt")
var team *model.Team var team *model.Team
if result := <-Srv.Store.Team().GetByName(name); result.Err != nil { if result := <-Srv.Store.Team().GetByName(c.T, name); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
...@@ -1822,7 +1822,7 @@ func GetAuthorizationCode(c *Context, service, teamName string, props map[string ...@@ -1822,7 +1822,7 @@ func GetAuthorizationCode(c *Context, service, teamName string, props map[string
return authUrl, nil return authUrl, nil
} }
func AuthorizeOAuthUser(service, code, state, redirectUri string) (io.ReadCloser, *model.Team, map[string]string, *model.AppError) { func AuthorizeOAuthUser(T goi18n.TranslateFunc, service, code, state, redirectUri string) (io.ReadCloser, *model.Team, map[string]string, *model.AppError) {
sso := utils.Cfg.GetSSOService(service) sso := utils.Cfg.GetSSOService(service)
if sso == nil || !sso.Enable { if sso == nil || !sso.Enable {
return nil, nil, nil, model.NewAppError("AuthorizeOAuthUser", "Unsupported OAuth service provider", "service="+service) return nil, nil, nil, model.NewAppError("AuthorizeOAuthUser", "Unsupported OAuth service provider", "service="+service)
...@@ -1847,7 +1847,7 @@ func AuthorizeOAuthUser(service, code, state, redirectUri string) (io.ReadCloser ...@@ -1847,7 +1847,7 @@ func AuthorizeOAuthUser(service, code, state, redirectUri string) (io.ReadCloser
return nil, nil, nil, model.NewAppError("AuthorizeOAuthUser", "Invalid state; missing team name", "") return nil, nil, nil, model.NewAppError("AuthorizeOAuthUser", "Invalid state; missing team name", "")
} }
tchan := Srv.Store.Team().GetByName(teamName) tchan := Srv.Store.Team().GetByName(T, teamName)
p := url.Values{} p := url.Values{}
p.Set("client_id", sso.Id) p.Set("client_id", sso.Id)
...@@ -1945,7 +1945,7 @@ func switchToSSO(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -1945,7 +1945,7 @@ func switchToSSO(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("attempt") c.LogAudit("attempt")
var team *model.Team var team *model.Team
if result := <-Srv.Store.Team().GetByName(teamName); result.Err != nil { if result := <-Srv.Store.Team().GetByName(c.T, teamName); result.Err != nil {
c.LogAudit("fail - couldn't get team") c.LogAudit("fail - couldn't get team")
c.Err = result.Err c.Err = result.Err
return return
...@@ -2049,7 +2049,7 @@ func switchToEmail(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -2049,7 +2049,7 @@ func switchToEmail(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("attempt") c.LogAudit("attempt")
var team *model.Team var team *model.Team
if result := <-Srv.Store.Team().GetByName(teamName); result.Err != nil { if result := <-Srv.Store.Team().GetByName(c.T, teamName); result.Err != nil {
c.LogAudit("fail - couldn't get team") c.LogAudit("fail - couldn't get team")
c.Err = result.Err c.Err = result.Err
return return
......
...@@ -70,7 +70,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) { ...@@ -70,7 +70,7 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
Type: model.TEAM_OPEN, Type: model.TEAM_OPEN,
} }
if result := <-api.Srv.Store.Team().Save(team); result.Err != nil { if result := <-api.Srv.Store.Team().Save(c.T, team); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
......
...@@ -301,7 +301,7 @@ func cmdCreateUser() { ...@@ -301,7 +301,7 @@ func cmdCreateUser() {
splits := strings.Split(strings.Replace(flagEmail, "@", " ", -1), " ") splits := strings.Split(strings.Replace(flagEmail, "@", " ", -1), " ")
user.Username = splits[0] user.Username = splits[0]
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil { if result := <-api.Srv.Store.Team().GetByName(utils.T, flagTeamName); result.Err != nil {
l4g.Error("%v", result.Err) l4g.Error("%v", result.Err)
flushLogAndExit(1) flushLogAndExit(1)
} else { } else {
...@@ -358,7 +358,7 @@ func cmdAssignRole() { ...@@ -358,7 +358,7 @@ func cmdAssignRole() {
c.IpAddress = "cmd_line" c.IpAddress = "cmd_line"
var team *model.Team var team *model.Team
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil { if result := <-api.Srv.Store.Team().GetByName(utils.T, flagTeamName); result.Err != nil {
l4g.Error("%v", result.Err) l4g.Error("%v", result.Err)
flushLogAndExit(1) flushLogAndExit(1)
} else { } else {
...@@ -412,7 +412,7 @@ func cmdResetPassword() { ...@@ -412,7 +412,7 @@ func cmdResetPassword() {
c.IpAddress = "cmd_line" c.IpAddress = "cmd_line"
var team *model.Team var team *model.Team
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil { if result := <-api.Srv.Store.Team().GetByName(utils.T, flagTeamName); result.Err != nil {
l4g.Error("%v", result.Err) l4g.Error("%v", result.Err)
flushLogAndExit(1) flushLogAndExit(1)
} else { } else {
...@@ -455,7 +455,7 @@ func cmdPermDeleteUser() { ...@@ -455,7 +455,7 @@ func cmdPermDeleteUser() {
c.IpAddress = "cmd_line" c.IpAddress = "cmd_line"
var team *model.Team var team *model.Team
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil { if result := <-api.Srv.Store.Team().GetByName(utils.T, flagTeamName); result.Err != nil {
l4g.Error("%v", result.Err) l4g.Error("%v", result.Err)
flushLogAndExit(1) flushLogAndExit(1)
} else { } else {
...@@ -506,7 +506,7 @@ func cmdPermDeleteTeam() { ...@@ -506,7 +506,7 @@ func cmdPermDeleteTeam() {
c.IpAddress = "cmd_line" c.IpAddress = "cmd_line"
var team *model.Team var team *model.Team
if result := <-api.Srv.Store.Team().GetByName(flagTeamName); result.Err != nil { if result := <-api.Srv.Store.Team().GetByName(utils.T, flagTeamName); result.Err != nil {
l4g.Error("%v", result.Err) l4g.Error("%v", result.Err)
flushLogAndExit(1) flushLogAndExit(1)
} else { } else {
......
...@@ -765,7 +765,7 @@ func TestUserCountsWithPostsByDay(t *testing.T) { ...@@ -765,7 +765,7 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
t1.Name = "a" + model.NewId() + "b" t1.Name = "a" + model.NewId() + "b"
t1.Email = model.NewId() + "@nowhere.com" t1.Email = model.NewId() + "@nowhere.com"
t1.Type = model.TEAM_OPEN t1.Type = model.TEAM_OPEN
t1 = Must(store.Team().Save(t1)).(*model.Team) t1 = Must(store.Team().Save(utils.T, t1)).(*model.Team)
c1 := &model.Channel{} c1 := &model.Channel{}
c1.TeamId = t1.Id c1.TeamId = t1.Id
...@@ -825,7 +825,7 @@ func TestPostCountsByDay(t *testing.T) { ...@@ -825,7 +825,7 @@ func TestPostCountsByDay(t *testing.T) {
t1.Name = "a" + model.NewId() + "b" t1.Name = "a" + model.NewId() + "b"
t1.Email = model.NewId() + "@nowhere.com" t1.Email = model.NewId() + "@nowhere.com"
t1.Type = model.TEAM_OPEN t1.Type = model.TEAM_OPEN
t1 = Must(store.Team().Save(t1)).(*model.Team) t1 = Must(store.Team().Save(utils.T, t1)).(*model.Team)
c1 := &model.Channel{} c1 := &model.Channel{}
c1.TeamId = t1.Id c1.TeamId = t1.Id
......
...@@ -6,6 +6,7 @@ package store ...@@ -6,6 +6,7 @@ package store
import ( import (
"github.com/mattermost/platform/model" "github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils" "github.com/mattermost/platform/utils"
goi18n "github.com/nicksnyder/go-i18n/i18n"
) )
type SqlTeamStore struct { type SqlTeamStore struct {
...@@ -37,7 +38,7 @@ func (s SqlTeamStore) CreateIndexesIfNotExists() { ...@@ -37,7 +38,7 @@ func (s SqlTeamStore) CreateIndexesIfNotExists() {
s.CreateIndexIfNotExists("idx_teams_invite_id", "Teams", "InviteId") s.CreateIndexIfNotExists("idx_teams_invite_id", "Teams", "InviteId")
} }
func (s SqlTeamStore) Save(team *model.Team) StoreChannel { func (s SqlTeamStore) Save(T goi18n.TranslateFunc, team *model.Team) StoreChannel {
storeChannel := make(StoreChannel) storeChannel := make(StoreChannel)
go func() { go func() {
...@@ -76,7 +77,7 @@ func (s SqlTeamStore) Save(team *model.Team) StoreChannel { ...@@ -76,7 +77,7 @@ func (s SqlTeamStore) Save(team *model.Team) StoreChannel {
return storeChannel return storeChannel
} }
func (s SqlTeamStore) Update(team *model.Team) StoreChannel { func (s SqlTeamStore) Update(T goi18n.TranslateFunc, team *model.Team) StoreChannel {
storeChannel := make(StoreChannel) storeChannel := make(StoreChannel)
...@@ -117,7 +118,7 @@ func (s SqlTeamStore) Update(team *model.Team) StoreChannel { ...@@ -117,7 +118,7 @@ func (s SqlTeamStore) Update(team *model.Team) StoreChannel {
return storeChannel return storeChannel
} }
func (s SqlTeamStore) UpdateDisplayName(name string, teamId string) StoreChannel { func (s SqlTeamStore) UpdateDisplayName(T goi18n.TranslateFunc, name string, teamId string) StoreChannel {
storeChannel := make(StoreChannel) storeChannel := make<