Commit 75f8729e authored by =Corey Hulen's avatar =Corey Hulen

PLT-7 adding loc db calls for users table

parent aac8d121
...@@ -128,7 +128,7 @@ func testEmail(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -128,7 +128,7 @@ func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
return return
} }
if result := <-Srv.Store.User().Get(c.Session.UserId); result.Err != nil { if result := <-Srv.Store.User().Get(c.T, c.Session.UserId); result.Err != nil {
c.Err = result.Err c.Err = result.Err
return return
} else { } else {
......
...@@ -19,7 +19,7 @@ func TestGetLogs(t *testing.T) { ...@@ -19,7 +19,7 @@ func TestGetLogs(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
...@@ -63,7 +63,7 @@ func TestGetConfig(t *testing.T) { ...@@ -63,7 +63,7 @@ func TestGetConfig(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
...@@ -97,7 +97,7 @@ func TestSaveConfig(t *testing.T) { ...@@ -97,7 +97,7 @@ func TestSaveConfig(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
...@@ -131,7 +131,7 @@ func TestEmailTest(t *testing.T) { ...@@ -131,7 +131,7 @@ func TestEmailTest(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
...@@ -159,7 +159,7 @@ func TestGetAnalyticsStandard(t *testing.T) { ...@@ -159,7 +159,7 @@ func TestGetAnalyticsStandard(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
...@@ -225,7 +225,7 @@ func TestGetPostCount(t *testing.T) { ...@@ -225,7 +225,7 @@ func TestGetPostCount(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
...@@ -270,7 +270,7 @@ func TestUserCountsWithPostsByDay(t *testing.T) { ...@@ -270,7 +270,7 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
......
...@@ -31,7 +31,7 @@ func SetupBenchmark() (*model.Team, *model.User, *model.Channel) { ...@@ -31,7 +31,7 @@ func SetupBenchmark() (*model.Team, *model.User, *model.Channel) {
team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team) team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
user := &model.User{TeamId: team.Id, Email: model.NewId() + "benchmark@test.com", Nickname: "Mr. Benchmarker", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "benchmark@test.com", Nickname: "Mr. Benchmarker", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
channel := &model.Channel{DisplayName: "Benchmark Channel", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id} channel := &model.Channel{DisplayName: "Benchmark Channel", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
channel = Client.Must(Client.CreateChannel(channel)).Data.(*model.Channel) channel = Client.Must(Client.CreateChannel(channel)).Data.(*model.Channel)
......
...@@ -46,7 +46,7 @@ func CreateBasicUser(client *model.Client) *model.AppError { ...@@ -46,7 +46,7 @@ func CreateBasicUser(client *model.Client) *model.AppError {
if err != nil { if err != nil {
return err return err
} }
store.Must(Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, result.Data.(*model.User).Id))
} }
return nil return nil
} }
...@@ -73,7 +73,7 @@ func (cfg *AutoUserCreator) createRandomUser() (*model.User, bool) { ...@@ -73,7 +73,7 @@ func (cfg *AutoUserCreator) createRandomUser() (*model.User, bool) {
return nil, false return nil, false
} }
// We need to cheat to verify the user's email // We need to cheat to verify the user's email
store.Must(Srv.Store.User().VerifyEmail(result.Data.(*model.User).Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, result.Data.(*model.User).Id))
return result.Data.(*model.User), true return result.Data.(*model.User), true
} }
......
...@@ -125,7 +125,7 @@ func CreateDirectChannel(c *Context, otherUserId string) (*model.Channel, *model ...@@ -125,7 +125,7 @@ func CreateDirectChannel(c *Context, otherUserId string) (*model.Channel, *model
return nil, model.NewAppError("CreateDirectChannel", "Invalid other user id ", otherUserId) return nil, model.NewAppError("CreateDirectChannel", "Invalid other user id ", otherUserId)
} }
uc := Srv.Store.User().Get(otherUserId) uc := Srv.Store.User().Get(c.T, otherUserId)
channel := new(model.Channel) channel := new(model.Channel)
...@@ -292,7 +292,7 @@ func updateChannelHeader(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -292,7 +292,7 @@ func updateChannelHeader(c *Context, w http.ResponseWriter, r *http.Request) {
func PostUpdateChannelHeaderMessageAndForget(c *Context, channelId string, oldChannelHeader, newChannelHeader string) { func PostUpdateChannelHeaderMessageAndForget(c *Context, channelId string, oldChannelHeader, newChannelHeader string) {
go func() { go func() {
uc := Srv.Store.User().Get(c.Session.UserId) uc := Srv.Store.User().Get(c.T, c.Session.UserId)
if uresult := <-uc; uresult.Err != nil { if uresult := <-uc; uresult.Err != nil {
l4g.Error("Failed to retrieve user while trying to save update channel header message %v", uresult.Err) l4g.Error("Failed to retrieve user while trying to save update channel header message %v", uresult.Err)
...@@ -371,7 +371,7 @@ func getChannels(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -371,7 +371,7 @@ func getChannels(c *Context, w http.ResponseWriter, r *http.Request) {
if result := <-Srv.Store.Channel().GetChannels(c.T, c.Session.TeamId, c.Session.UserId); result.Err != nil { if result := <-Srv.Store.Channel().GetChannels(c.T, c.Session.TeamId, c.Session.UserId); result.Err != nil {
if result.Err.Message == "No channels were found" { if result.Err.Message == "No channels were found" {
// lets make sure the user is valid // lets make sure the user is valid
if result := <-Srv.Store.User().Get(c.Session.UserId); result.Err != nil { if result := <-Srv.Store.User().Get(c.T, c.Session.UserId); result.Err != nil {
c.Err = result.Err c.Err = result.Err
c.RemoveSessionCookie(w, r) c.RemoveSessionCookie(w, r)
l4g.Error("Error in getting users profile for id=%v forcing logout", c.Session.UserId) l4g.Error("Error in getting users profile for id=%v forcing logout", c.Session.UserId)
...@@ -440,7 +440,7 @@ func join(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -440,7 +440,7 @@ func join(c *Context, w http.ResponseWriter, r *http.Request) {
func JoinChannel(c *Context, channelId string, role string) { func JoinChannel(c *Context, channelId string, role string) {
sc := Srv.Store.Channel().Get(c.T, channelId) sc := Srv.Store.Channel().Get(c.T, channelId)
uc := Srv.Store.User().Get(c.Session.UserId) uc := Srv.Store.User().Get(c.T, c.Session.UserId)
if cresult := <-sc; cresult.Err != nil { if cresult := <-sc; cresult.Err != nil {
c.Err = cresult.Err c.Err = cresult.Err
...@@ -544,7 +544,7 @@ func leave(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -544,7 +544,7 @@ func leave(c *Context, w http.ResponseWriter, r *http.Request) {
id := params["id"] id := params["id"]
sc := Srv.Store.Channel().Get(c.T, id) sc := Srv.Store.Channel().Get(c.T, id)
uc := Srv.Store.User().Get(c.Session.UserId) uc := Srv.Store.User().Get(c.T, c.Session.UserId)
if cresult := <-sc; cresult.Err != nil { if cresult := <-sc; cresult.Err != nil {
c.Err = cresult.Err c.Err = cresult.Err
...@@ -594,7 +594,7 @@ func deleteChannel(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -594,7 +594,7 @@ func deleteChannel(c *Context, w http.ResponseWriter, r *http.Request) {
sc := Srv.Store.Channel().Get(c.T, id) sc := Srv.Store.Channel().Get(c.T, id)
scm := Srv.Store.Channel().GetMember(c.T, id, c.Session.UserId) scm := Srv.Store.Channel().GetMember(c.T, id, c.Session.UserId)
uc := Srv.Store.User().Get(c.Session.UserId) uc := Srv.Store.User().Get(c.T, c.Session.UserId)
ihc := Srv.Store.Webhook().GetIncomingByChannel(c.T, id) ihc := Srv.Store.Webhook().GetIncomingByChannel(c.T, id)
ohc := Srv.Store.Webhook().GetOutgoingByChannel(c.T, id) ohc := Srv.Store.Webhook().GetOutgoingByChannel(c.T, id)
...@@ -818,8 +818,8 @@ func addMember(c *Context, w http.ResponseWriter, r *http.Request) { ...@@ -818,8 +818,8 @@ func addMember(c *Context, w http.ResponseWriter, r *http.Request) {
cchan := Srv.Store.Channel().CheckPermissionsTo(c.T, c.Session.TeamId, id, c.Session.UserId) cchan := Srv.Store.Channel().CheckPermissionsTo(c.T, c.Session.TeamId, id, c.Session.UserId)
sc := Srv.Store.Channel().Get(c.T, id) sc := Srv.Store.Channel().Get(c.T, id)
ouc := Srv.Store.User().Get(c.Session.UserId) ouc := Srv.Store.User().Get(c.T, c.Session.UserId)
nuc := Srv.Store.User().Get(userId) nuc := Srv.Store.User().Get(c.T, userId)
// Only need to be a member of the channel to add a new member // Only need to be a member of the channel to add a new member
if !c.HasPermissionsToChannel(cchan, "addMember") { if !c.HasPermissionsToChannel(cchan, "addMember") {
......
...@@ -140,7 +140,7 @@ func BenchmarkJoinChannel(b *testing.B) { ...@@ -140,7 +140,7 @@ func BenchmarkJoinChannel(b *testing.B) {
// Secondary test user to join channels created by primary test user // Secondary test user to join channels created by primary test user
user := &model.User{TeamId: team.Id, Email: model.NewId() + "random@test.com", Nickname: "That Guy", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "random@test.com", Nickname: "That Guy", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
// Benchmark Start // Benchmark Start
......
This diff is collapsed.
...@@ -544,7 +544,7 @@ func loadTestPostsCommand(c *Context, command *model.Command) bool { ...@@ -544,7 +544,7 @@ func loadTestPostsCommand(c *Context, command *model.Command) bool {
} }
var usernames []string var usernames []string
if result := <-Srv.Store.User().GetProfiles(c.Session.TeamId); result.Err == nil { if result := <-Srv.Store.User().GetProfiles(c.T, c.Session.TeamId); result.Err == nil {
profileUsers := result.Data.(map[string]*model.User) profileUsers := result.Data.(map[string]*model.User)
usernames = make([]string, len(profileUsers)) usernames = make([]string, len(profileUsers))
i := 0 i := 0
......
...@@ -21,7 +21,7 @@ func TestSuggestRootCommands(t *testing.T) { ...@@ -21,7 +21,7 @@ func TestSuggestRootCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
...@@ -70,7 +70,7 @@ func TestLogoutCommands(t *testing.T) { ...@@ -70,7 +70,7 @@ func TestLogoutCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
...@@ -88,7 +88,7 @@ func TestJoinCommands(t *testing.T) { ...@@ -88,7 +88,7 @@ func TestJoinCommands(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
...@@ -102,7 +102,7 @@ func TestJoinCommands(t *testing.T) { ...@@ -102,7 +102,7 @@ func TestJoinCommands(t *testing.T) {
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User) user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
data := make(map[string]string) data := make(map[string]string)
data["user_id"] = user2.Id data["user_id"] = user2.Id
...@@ -164,7 +164,7 @@ func TestEchoCommand(t *testing.T) { ...@@ -164,7 +164,7 @@ func TestEchoCommand(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
...@@ -202,7 +202,7 @@ func TestLoadTestUrlCommand(t *testing.T) { ...@@ -202,7 +202,7 @@ func TestLoadTestUrlCommand(t *testing.T) {
user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user.Id))
Client.LoginByEmail(team.Name, user.Email, "pwd") Client.LoginByEmail(team.Name, user.Email, "pwd")
......
...@@ -195,7 +195,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ...@@ -195,7 +195,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if c.Err == nil && h.isUserActivity && token != "" && len(c.Session.UserId) > 0 { if c.Err == nil && h.isUserActivity && token != "" && len(c.Session.UserId) > 0 {
go func() { go func() {
if err := (<-Srv.Store.User().UpdateUserAndSessionActivity(c.Session.UserId, c.Session.Id, model.GetMillis())).Err; err != nil { if err := (<-Srv.Store.User().UpdateUserAndSessionActivity(c.T, c.Session.UserId, c.Session.Id, model.GetMillis())).Err; err != nil {
l4g.Error("Failed to update LastActivityAt for user_id=%v and session_id=%v, err=%v", c.Session.UserId, c.Session.Id, err) l4g.Error("Failed to update LastActivityAt for user_id=%v and session_id=%v, err=%v", c.Session.UserId, c.Session.Id, err)
} }
}() }()
......
...@@ -125,7 +125,7 @@ func ExportTeams(T goi18n.TranslateFunc, writer ExportWriter, options *ExportOpt ...@@ -125,7 +125,7 @@ func ExportTeams(T goi18n.TranslateFunc, writer ExportWriter, options *ExportOpt
if err := ExportChannels(T, writer, options, team.Id); err != nil { if err := ExportChannels(T, writer, options, team.Id); err != nil {
return err return err
} }
if err := ExportUsers(writer, options, team.Id); err != nil { if err := ExportUsers(T, writer, options, team.Id); err != nil {
return err return err
} }
if err := ExportLocalStorage(writer, options, team.Id); err != nil { if err := ExportLocalStorage(writer, options, team.Id); err != nil {
...@@ -225,10 +225,10 @@ func ExportPosts(T goi18n.TranslateFunc, writer ExportWriter, options *ExportOpt ...@@ -225,10 +225,10 @@ func ExportPosts(T goi18n.TranslateFunc, writer ExportWriter, options *ExportOpt
return nil return nil
} }
func ExportUsers(writer ExportWriter, options *ExportOptions, teamId string) *model.AppError { func ExportUsers(T goi18n.TranslateFunc, writer ExportWriter, options *ExportOptions, teamId string) *model.AppError {
// Get the users // Get the users
var users []*model.User var users []*model.User
if result := <-Srv.Store.User().GetForExport(teamId); result.Err != nil { if result := <-Srv.Store.User().GetForExport(T, teamId); result.Err != nil {
return result.Err return result.Err
} else { } else {
users = result.Data.([]*model.User) users = result.Data.([]*model.User)
......
...@@ -29,7 +29,7 @@ func TestUploadFile(t *testing.T) { ...@@ -29,7 +29,7 @@ func TestUploadFile(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
...@@ -144,7 +144,7 @@ func TestGetFile(t *testing.T) { ...@@ -144,7 +144,7 @@ func TestGetFile(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
...@@ -214,7 +214,7 @@ func TestGetFile(t *testing.T) { ...@@ -214,7 +214,7 @@ func TestGetFile(t *testing.T) {
user2 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user2 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User) user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
newProps := make(map[string]string) newProps := make(map[string]string)
newProps["filename"] = filenames[0] newProps["filename"] = filenames[0]
...@@ -322,11 +322,11 @@ func TestGetPublicLink(t *testing.T) { ...@@ -322,11 +322,11 @@ func TestGetPublicLink(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User) user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
......
...@@ -25,7 +25,7 @@ func ImportPost(T goi18n.TranslateFunc, post *model.Post) { ...@@ -25,7 +25,7 @@ func ImportPost(T goi18n.TranslateFunc, post *model.Post) {
func ImportUser(T goi18n.TranslateFunc, user *model.User) *model.User { func ImportUser(T goi18n.TranslateFunc, user *model.User) *model.User {
user.MakeNonNil() user.MakeNonNil()
if result := <-Srv.Store.User().Save(user); result.Err != nil { if result := <-Srv.Store.User().Save(T, user); result.Err != nil {
l4g.Error("Error saving user. err=%v", result.Err) l4g.Error("Error saving user. err=%v", result.Err)
return nil return nil
} else { } else {
...@@ -35,7 +35,7 @@ func ImportUser(T goi18n.TranslateFunc, user *model.User) *model.User { ...@@ -35,7 +35,7 @@ func ImportUser(T goi18n.TranslateFunc, 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)
} }
if cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil { if cresult := <-Srv.Store.User().VerifyEmail(T, 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)
} }
......
...@@ -20,7 +20,7 @@ func TestRegisterApp(t *testing.T) { ...@@ -20,7 +20,7 @@ func TestRegisterApp(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey+test@test.com", Password: "pwd"} user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey+test@test.com", Password: "pwd"}
ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User) ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(ruser.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, ruser.Id))
app := &model.OAuthApp{Name: "TestApp" + model.NewId(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}} app := &model.OAuthApp{Name: "TestApp" + model.NewId(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}}
...@@ -77,7 +77,7 @@ func TestAllowOAuth(t *testing.T) { ...@@ -77,7 +77,7 @@ func TestAllowOAuth(t *testing.T) {
user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey+test@test.com", Password: "pwd"} user := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey+test@test.com", Password: "pwd"}
ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User) ruser := Client.Must(Client.CreateUser(&user, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(ruser.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, ruser.Id))
app := &model.OAuthApp{Name: "TestApp" + model.NewId(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}} app := &model.OAuthApp{Name: "TestApp" + model.NewId(), Homepage: "https://nowhere.com", Description: "test", CallbackUrls: []string{"https://nowhere.com"}}
......
...@@ -207,7 +207,7 @@ func handlePostEventsAndForget(c *Context, post *model.Post, triggerWebhooks boo ...@@ -207,7 +207,7 @@ func handlePostEventsAndForget(c *Context, post *model.Post, triggerWebhooks boo
go func() { go func() {
tchan := Srv.Store.Team().Get(c.T, c.Session.TeamId) tchan := Srv.Store.Team().Get(c.T, c.Session.TeamId)
cchan := Srv.Store.Channel().Get(c.T, post.ChannelId) cchan := Srv.Store.Channel().Get(c.T, post.ChannelId)
uchan := Srv.Store.User().Get(post.UserId) uchan := Srv.Store.User().Get(c.T, post.UserId)
var team *model.Team var team *model.Team
if result := <-tchan; result.Err != nil { if result := <-tchan; result.Err != nil {
...@@ -394,7 +394,7 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team, ...@@ -394,7 +394,7 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team,
go func() { go func() {
// Get a list of user names (to be used as keywords) and ids for the given team // Get a list of user names (to be used as keywords) and ids for the given team
uchan := Srv.Store.User().GetProfiles(c.Session.TeamId) uchan := Srv.Store.User().GetProfiles(c.T, c.Session.TeamId)
echan := Srv.Store.Channel().GetMembers(c.T, post.ChannelId) echan := Srv.Store.Channel().GetMembers(c.T, post.ChannelId)
var channelName string var channelName string
......
...@@ -23,11 +23,11 @@ func TestCreatePost(t *testing.T) { ...@@ -23,11 +23,11 @@ func TestCreatePost(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User) user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
...@@ -105,7 +105,7 @@ func TestCreatePost(t *testing.T) { ...@@ -105,7 +105,7 @@ func TestCreatePost(t *testing.T) {
user3 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user3 := &model.User{TeamId: team2.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User) user3 = Client.Must(Client.CreateUser(user3, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user3.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user3.Id))
Client.LoginByEmail(team2.Name, user3.Email, "pwd") Client.LoginByEmail(team2.Name, user3.Email, "pwd")
...@@ -134,11 +134,11 @@ func TestUpdatePost(t *testing.T) { ...@@ -134,11 +134,11 @@ func TestUpdatePost(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user1.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user1.Id))
user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user2 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User) user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
store.Must(Srv.Store.User().VerifyEmail(user2.Id)) store.Must(Srv.Store.User().VerifyEmail(utils.T, user2.Id))
Client.LoginByEmail(team.Name, user1.Email, "pwd") Client.LoginByEmail(team.Name, user1.Email, "pwd")
...@@ -202,7 +202,7 @@ func TestGetPosts(t *testing.T) { ...@@ -202,7 +202,7 @@ func TestGetPosts(t *testing.T) {
user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"} user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User) user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)