Merge pull request #1246 from trashcan/fix-spelling
Fix spelling of "encountered" and "environment"
Этот коммит содержится в:
@@ -10,42 +10,42 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type TestEnviroment struct {
|
||||
Teams []*model.Team
|
||||
Enviroments []TeamEnviroment
|
||||
type TestEnvironment struct {
|
||||
Teams []*model.Team
|
||||
Environments []TeamEnvironment
|
||||
}
|
||||
|
||||
func CreateTestEnviromentWithTeams(client *model.Client, rangeTeams utils.Range, rangeChannels utils.Range, rangeUsers utils.Range, rangePosts utils.Range, fuzzy bool) (TestEnviroment, bool) {
|
||||
func CreateTestEnvironmentWithTeams(client *model.Client, rangeTeams utils.Range, rangeChannels utils.Range, rangeUsers utils.Range, rangePosts utils.Range, fuzzy bool) (TestEnvironment, bool) {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
|
||||
teamCreator := NewAutoTeamCreator(client)
|
||||
teamCreator.Fuzzy = fuzzy
|
||||
teams, err := teamCreator.CreateTestTeams(rangeTeams)
|
||||
if err != true {
|
||||
return TestEnviroment{}, false
|
||||
return TestEnvironment{}, false
|
||||
}
|
||||
|
||||
enviroment := TestEnviroment{teams, make([]TeamEnviroment, len(teams))}
|
||||
environment := TestEnvironment{teams, make([]TeamEnvironment, len(teams))}
|
||||
|
||||
for i, team := range teams {
|
||||
userCreator := NewAutoUserCreator(client, team.Id)
|
||||
userCreator.Fuzzy = fuzzy
|
||||
randomUser, err := userCreator.createRandomUser()
|
||||
if err != true {
|
||||
return TestEnviroment{}, false
|
||||
return TestEnvironment{}, false
|
||||
}
|
||||
client.LoginById(randomUser.Id, USER_PASSWORD)
|
||||
teamEnviroment, err := CreateTestEnviromentInTeam(client, team.Id, rangeChannels, rangeUsers, rangePosts, fuzzy)
|
||||
teamEnvironment, err := CreateTestEnvironmentInTeam(client, team.Id, rangeChannels, rangeUsers, rangePosts, fuzzy)
|
||||
if err != true {
|
||||
return TestEnviroment{}, false
|
||||
return TestEnvironment{}, false
|
||||
}
|
||||
enviroment.Enviroments[i] = teamEnviroment
|
||||
environment.Environments[i] = teamEnvironment
|
||||
}
|
||||
|
||||
return enviroment, true
|
||||
return environment, true
|
||||
}
|
||||
|
||||
func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChannels utils.Range, rangeUsers utils.Range, rangePosts utils.Range, fuzzy bool) (TeamEnviroment, bool) {
|
||||
func CreateTestEnvironmentInTeam(client *model.Client, teamID string, rangeChannels utils.Range, rangeUsers utils.Range, rangePosts utils.Range, fuzzy bool) (TeamEnvironment, bool) {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
|
||||
// We need to create at least one user
|
||||
@@ -57,7 +57,7 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne
|
||||
userCreator.Fuzzy = fuzzy
|
||||
users, err := userCreator.CreateTestUsers(rangeUsers)
|
||||
if err != true {
|
||||
return TeamEnviroment{}, false
|
||||
return TeamEnvironment{}, false
|
||||
}
|
||||
usernames := make([]string, len(users))
|
||||
for i, user := range users {
|
||||
@@ -77,7 +77,7 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne
|
||||
}
|
||||
|
||||
if err != true {
|
||||
return TeamEnviroment{}, false
|
||||
return TeamEnvironment{}, false
|
||||
}
|
||||
numPosts := utils.RandIntFromRange(rangePosts)
|
||||
numImages := utils.RandIntFromRange(rangePosts) / 4
|
||||
@@ -93,5 +93,5 @@ func CreateTestEnviromentInTeam(client *model.Client, teamID string, rangeChanne
|
||||
}
|
||||
}
|
||||
|
||||
return TeamEnviroment{users, channels}, true
|
||||
return TeamEnvironment{users, channels}, true
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/mattermost/platform/utils"
|
||||
)
|
||||
|
||||
type TeamEnviroment struct {
|
||||
type TeamEnvironment struct {
|
||||
Users []*model.User
|
||||
Channels []*model.Channel
|
||||
}
|
||||
|
||||
@@ -381,11 +381,11 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool {
|
||||
|
||||
if doTeams {
|
||||
if err := CreateBasicUser(client); err != nil {
|
||||
l4g.Error("Failed to create testing enviroment")
|
||||
l4g.Error("Failed to create testing environment")
|
||||
return true
|
||||
}
|
||||
client.LoginByEmail(BTEST_TEAM_NAME, BTEST_USER_EMAIL, BTEST_USER_PASSWORD)
|
||||
enviroment, err := CreateTestEnviromentWithTeams(
|
||||
environment, err := CreateTestEnvironmentWithTeams(
|
||||
client,
|
||||
utils.Range{numTeams, numTeams},
|
||||
utils.Range{numChannels, numChannels},
|
||||
@@ -393,18 +393,18 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool {
|
||||
utils.Range{numPosts, numPosts},
|
||||
doFuzz)
|
||||
if err != true {
|
||||
l4g.Error("Failed to create testing enviroment")
|
||||
l4g.Error("Failed to create testing environment")
|
||||
return true
|
||||
} else {
|
||||
l4g.Info("Testing enviroment created")
|
||||
for i := 0; i < len(enviroment.Teams); i++ {
|
||||
l4g.Info("Team Created: " + enviroment.Teams[i].Name)
|
||||
l4g.Info("\t User to login: " + enviroment.Enviroments[i].Users[0].Email + ", " + USER_PASSWORD)
|
||||
l4g.Info("Testing environment created")
|
||||
for i := 0; i < len(environment.Teams); i++ {
|
||||
l4g.Info("Team Created: " + environment.Teams[i].Name)
|
||||
l4g.Info("\t User to login: " + environment.Environments[i].Users[0].Email + ", " + USER_PASSWORD)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
client.MockSession(c.Session.Token)
|
||||
CreateTestEnviromentInTeam(
|
||||
CreateTestEnvironmentInTeam(
|
||||
client,
|
||||
c.Session.TeamId,
|
||||
utils.Range{numChannels, numChannels},
|
||||
@@ -416,7 +416,7 @@ func loadTestSetupCommand(c *Context, command *model.Command) bool {
|
||||
} else if strings.Index(cmd, command.Command) == 0 {
|
||||
command.AddSuggestion(&model.SuggestCommand{
|
||||
Suggestion: cmd,
|
||||
Description: "Creates a testing enviroment in current team. [teams] [fuzz] <Num Channels> <Num Users> <NumPosts>"})
|
||||
Description: "Creates a testing environment in current team. [teams] [fuzz] <Num Channels> <Num Users> <NumPosts>"})
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type TestEnviroment struct {
|
||||
type TestEnvironment struct {
|
||||
Params map[string][]string
|
||||
Client *model.Client
|
||||
CreatedTeamId string
|
||||
@@ -121,8 +121,8 @@ func manualTest(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/channels/town-square", http.StatusTemporaryRedirect)
|
||||
}
|
||||
|
||||
// Setup test enviroment
|
||||
env := TestEnviroment{
|
||||
// Setup test environment
|
||||
env := TestEnvironment{
|
||||
Params: params,
|
||||
Client: client,
|
||||
CreatedTeamId: teamID,
|
||||
|
||||
@@ -19,7 +19,7 @@ http://www.google.com.pk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8
|
||||
https://medium.com/@slackhq/11-useful-tips-for-getting-the-most-of-slack-5dfb3d1af77
|
||||
`
|
||||
|
||||
func testAutoLink(env TestEnviroment) *model.AppError {
|
||||
func testAutoLink(env TestEnvironment) *model.AppError {
|
||||
l4g.Info("Manual Auto Link Test")
|
||||
channelID, err := getChannelID(model.DEFAULT_CHANNEL, env.CreatedTeamId, env.CreatedUserId)
|
||||
if err != true {
|
||||
|
||||
@@ -46,7 +46,7 @@ func (s SqlAuditStore) Save(audit *model.Audit) StoreChannel {
|
||||
|
||||
if err := s.GetMaster().Insert(audit); err != nil {
|
||||
result.Err = model.NewAppError("SqlAuditStore.Save",
|
||||
"We encounted an error saving the audit", "user_id="+
|
||||
"We encountered an error saving the audit", "user_id="+
|
||||
audit.UserId+" action="+audit.Action)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ func (s SqlAuditStore) Get(user_id string, limit int) StoreChannel {
|
||||
var audits model.Audits
|
||||
if _, err := s.GetReplica().Select(&audits, "SELECT * FROM Audits WHERE UserId = :user_id ORDER BY CreateAt DESC LIMIT :limit",
|
||||
map[string]interface{}{"user_id": user_id, "limit": limit}); err != nil {
|
||||
result.Err = model.NewAppError("SqlAuditStore.Get", "We encounted an error finding the audits", "user_id="+user_id)
|
||||
result.Err = model.NewAppError("SqlAuditStore.Get", "We encountered an error finding the audits", "user_id="+user_id)
|
||||
} else {
|
||||
result.Data = audits
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ func (s SqlChannelStore) Update(channel *model.Channel) StoreChannel {
|
||||
result.Err = model.NewAppError("SqlChannelStore.Update", "A channel with that handle already exists", "id="+channel.Id+", "+err.Error())
|
||||
}
|
||||
} else {
|
||||
result.Err = model.NewAppError("SqlChannelStore.Update", "We encounted an error updating the channel", "id="+channel.Id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlChannelStore.Update", "We encountered an error updating the channel", "id="+channel.Id+", "+err.Error())
|
||||
}
|
||||
} else if count != 1 {
|
||||
result.Err = model.NewAppError("SqlChannelStore.Update", "We couldn't update the channel", "id="+channel.Id)
|
||||
@@ -297,7 +297,7 @@ func (s SqlChannelStore) Get(id string) StoreChannel {
|
||||
result := StoreResult{}
|
||||
|
||||
if obj, err := s.GetReplica().Get(model.Channel{}, id); err != nil {
|
||||
result.Err = model.NewAppError("SqlChannelStore.Get", "We encounted an error finding the channel", "id="+id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlChannelStore.Get", "We encountered an error finding the channel", "id="+id+", "+err.Error())
|
||||
} else if obj == nil {
|
||||
result.Err = model.NewAppError("SqlChannelStore.Get", "We couldn't find the existing channel", "id="+id)
|
||||
} else {
|
||||
@@ -537,7 +537,7 @@ func (s SqlChannelStore) UpdateMember(member *model.ChannelMember) StoreChannel
|
||||
}
|
||||
|
||||
if _, err := s.GetMaster().Update(member); err != nil {
|
||||
result.Err = model.NewAppError("SqlChannelStore.UpdateMember", "We encounted an error updating the channel member",
|
||||
result.Err = model.NewAppError("SqlChannelStore.UpdateMember", "We encountered an error updating the channel member",
|
||||
"channel_id="+member.ChannelId+", "+"user_id="+member.UserId+", "+err.Error())
|
||||
} else {
|
||||
result.Data = member
|
||||
|
||||
@@ -102,7 +102,7 @@ func (as SqlOAuthStore) UpdateApp(app *model.OAuthApp) StoreChannel {
|
||||
}
|
||||
|
||||
if oldAppResult, err := as.GetMaster().Get(model.OAuthApp{}, app.Id); err != nil {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We encounted an error finding the app", "app_id="+app.Id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We encountered an error finding the app", "app_id="+app.Id+", "+err.Error())
|
||||
} else if oldAppResult == nil {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We couldn't find the existing app to update", "app_id="+app.Id)
|
||||
} else {
|
||||
@@ -112,7 +112,7 @@ func (as SqlOAuthStore) UpdateApp(app *model.OAuthApp) StoreChannel {
|
||||
app.CreatorId = oldApp.CreatorId
|
||||
|
||||
if count, err := as.GetMaster().Update(app); err != nil {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We encounted an error updating the app", "app_id="+app.Id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We encountered an error updating the app", "app_id="+app.Id+", "+err.Error())
|
||||
} else if count != 1 {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.UpdateApp", "We couldn't update the app", "app_id="+app.Id)
|
||||
} else {
|
||||
@@ -135,7 +135,7 @@ func (as SqlOAuthStore) GetApp(id string) StoreChannel {
|
||||
result := StoreResult{}
|
||||
|
||||
if obj, err := as.GetReplica().Get(model.OAuthApp{}, id); err != nil {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.GetApp", "We encounted an error finding the app", "app_id="+id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlOAuthStore.GetApp", "We encountered an error finding the app", "app_id="+id+", "+err.Error())
|
||||
} else if obj == nil {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.GetApp", "We couldn't find the existing app", "app_id="+id)
|
||||
} else {
|
||||
@@ -208,7 +208,7 @@ func (as SqlOAuthStore) GetAccessData(token string) StoreChannel {
|
||||
accessData := model.AccessData{}
|
||||
|
||||
if err := as.GetReplica().SelectOne(&accessData, "SELECT * FROM OAuthAccessData WHERE Token = :Token", map[string]interface{}{"Token": token}); err != nil {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.GetAccessData", "We encounted an error finding the access token", err.Error())
|
||||
result.Err = model.NewAppError("SqlOAuthStore.GetAccessData", "We encountered an error finding the access token", err.Error())
|
||||
} else {
|
||||
result.Data = &accessData
|
||||
}
|
||||
@@ -300,7 +300,7 @@ func (as SqlOAuthStore) GetAuthData(code string) StoreChannel {
|
||||
result := StoreResult{}
|
||||
|
||||
if obj, err := as.GetReplica().Get(model.AuthData{}, code); err != nil {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.GetAuthData", "We encounted an error finding the authorization code", err.Error())
|
||||
result.Err = model.NewAppError("SqlOAuthStore.GetAuthData", "We encountered an error finding the authorization code", err.Error())
|
||||
} else if obj == nil {
|
||||
result.Err = model.NewAppError("SqlOAuthStore.GetAuthData", "We couldn't find the existing authorization code", "")
|
||||
} else {
|
||||
|
||||
@@ -548,7 +548,7 @@ func (s SqlPostStore) Search(teamId string, userId string, params *model.SearchP
|
||||
|
||||
_, err := s.GetReplica().Select(&posts, searchQuery, queryParams)
|
||||
if err != nil {
|
||||
result.Err = model.NewAppError("SqlPostStore.Search", "We encounted an error while searching for posts", "teamId="+teamId+", err="+err.Error())
|
||||
result.Err = model.NewAppError("SqlPostStore.Search", "We encountered an error while searching for posts", "teamId="+teamId+", err="+err.Error())
|
||||
}
|
||||
|
||||
list := &model.PostList{Order: make([]string, 0, len(posts))}
|
||||
|
||||
@@ -173,7 +173,7 @@ func (s SqlPreferenceStore) Get(userId string, category string, name string) Sto
|
||||
UserId = :UserId
|
||||
AND Category = :Category
|
||||
AND Name = :Name`, map[string]interface{}{"UserId": userId, "Category": category, "Name": name}); err != nil {
|
||||
result.Err = model.NewAppError("SqlPreferenceStore.Get", "We encounted an error while finding preferences", err.Error())
|
||||
result.Err = model.NewAppError("SqlPreferenceStore.Get", "We encountered an error while finding preferences", err.Error())
|
||||
} else {
|
||||
result.Data = preference
|
||||
}
|
||||
@@ -201,7 +201,7 @@ func (s SqlPreferenceStore) GetCategory(userId string, category string) StoreCha
|
||||
WHERE
|
||||
UserId = :UserId
|
||||
AND Category = :Category`, map[string]interface{}{"UserId": userId, "Category": category}); err != nil {
|
||||
result.Err = model.NewAppError("SqlPreferenceStore.GetCategory", "We encounted an error while finding preferences", err.Error())
|
||||
result.Err = model.NewAppError("SqlPreferenceStore.GetCategory", "We encountered an error while finding preferences", err.Error())
|
||||
} else {
|
||||
result.Data = preferences
|
||||
}
|
||||
@@ -228,7 +228,7 @@ func (s SqlPreferenceStore) GetAll(userId string) StoreChannel {
|
||||
Preferences
|
||||
WHERE
|
||||
UserId = :UserId`, map[string]interface{}{"UserId": userId}); err != nil {
|
||||
result.Err = model.NewAppError("SqlPreferenceStore.GetAll", "We encounted an error while finding preferences", err.Error())
|
||||
result.Err = model.NewAppError("SqlPreferenceStore.GetAll", "We encountered an error while finding preferences", err.Error())
|
||||
} else {
|
||||
result.Data = preferences
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ func (me SqlSessionStore) Get(sessionIdOrToken string) StoreChannel {
|
||||
var sessions []*model.Session
|
||||
|
||||
if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE Token = :Token OR Id = :Id LIMIT 1", map[string]interface{}{"Token": sessionIdOrToken, "Id": sessionIdOrToken}); err != nil {
|
||||
result.Err = model.NewAppError("SqlSessionStore.Get", "We encounted an error finding the session", "sessionIdOrToken="+sessionIdOrToken+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlSessionStore.Get", "We encountered an error finding the session", "sessionIdOrToken="+sessionIdOrToken+", "+err.Error())
|
||||
} else if sessions == nil || len(sessions) == 0 {
|
||||
result.Err = model.NewAppError("SqlSessionStore.Get", "We encounted an error finding the session", "sessionIdOrToken="+sessionIdOrToken)
|
||||
result.Err = model.NewAppError("SqlSessionStore.Get", "We encountered an error finding the session", "sessionIdOrToken="+sessionIdOrToken)
|
||||
} else {
|
||||
result.Data = sessions[0]
|
||||
}
|
||||
@@ -109,7 +109,7 @@ func (me SqlSessionStore) GetSessions(userId string) StoreChannel {
|
||||
var sessions []*model.Session
|
||||
|
||||
if _, err := me.GetReplica().Select(&sessions, "SELECT * FROM Sessions WHERE UserId = :UserId ORDER BY LastActivityAt DESC", map[string]interface{}{"UserId": userId}); err != nil {
|
||||
result.Err = model.NewAppError("SqlSessionStore.GetSessions", "We encounted an error while finding user sessions", err.Error())
|
||||
result.Err = model.NewAppError("SqlSessionStore.GetSessions", "We encountered an error while finding user sessions", err.Error())
|
||||
} else {
|
||||
|
||||
result.Data = sessions
|
||||
@@ -165,7 +165,7 @@ func (me SqlSessionStore) CleanUpExpiredSessions(userId string) StoreChannel {
|
||||
result := StoreResult{}
|
||||
|
||||
if _, err := me.GetMaster().Exec("DELETE FROM Sessions WHERE UserId = :UserId AND ExpiresAt != 0 AND :ExpiresAt > ExpiresAt", map[string]interface{}{"UserId": userId, "ExpiresAt": model.GetMillis()}); err != nil {
|
||||
result.Err = model.NewAppError("SqlSessionStore.CleanUpExpiredSessions", "We encounted an error while deleting expired user sessions", err.Error())
|
||||
result.Err = model.NewAppError("SqlSessionStore.CleanUpExpiredSessions", "We encountered an error while deleting expired user sessions", err.Error())
|
||||
} else {
|
||||
result.Data = userId
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func (s SqlSystemStore) Save(system *model.System) StoreChannel {
|
||||
result := StoreResult{}
|
||||
|
||||
if err := s.GetMaster().Insert(system); err != nil {
|
||||
result.Err = model.NewAppError("SqlSystemStore.Save", "We encounted an error saving the system property", "")
|
||||
result.Err = model.NewAppError("SqlSystemStore.Save", "We encountered an error saving the system property", "")
|
||||
}
|
||||
|
||||
storeChannel <- result
|
||||
@@ -55,7 +55,7 @@ func (s SqlSystemStore) Update(system *model.System) StoreChannel {
|
||||
result := StoreResult{}
|
||||
|
||||
if _, err := s.GetMaster().Update(system); err != nil {
|
||||
result.Err = model.NewAppError("SqlSystemStore.Save", "We encounted an error updating the system property", "")
|
||||
result.Err = model.NewAppError("SqlSystemStore.Save", "We encountered an error updating the system property", "")
|
||||
}
|
||||
|
||||
storeChannel <- result
|
||||
@@ -75,7 +75,7 @@ func (s SqlSystemStore) Get() StoreChannel {
|
||||
var systems []model.System
|
||||
props := make(model.StringMap)
|
||||
if _, err := s.GetReplica().Select(&systems, "SELECT * FROM Systems"); err != nil {
|
||||
result.Err = model.NewAppError("SqlSystemStore.Get", "We encounted an error finding the system properties", "")
|
||||
result.Err = model.NewAppError("SqlSystemStore.Get", "We encountered an error finding the system properties", "")
|
||||
} else {
|
||||
for _, prop := range systems {
|
||||
props[prop.Name] = prop.Value
|
||||
|
||||
@@ -97,7 +97,7 @@ func (s SqlTeamStore) Update(team *model.Team) StoreChannel {
|
||||
}
|
||||
|
||||
if oldResult, err := s.GetMaster().Get(model.Team{}, team.Id); err != nil {
|
||||
result.Err = model.NewAppError("SqlTeamStore.Update", "We encounted an error finding the team", "id="+team.Id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlTeamStore.Update", "We encountered an error finding the team", "id="+team.Id+", "+err.Error())
|
||||
} else if oldResult == nil {
|
||||
result.Err = model.NewAppError("SqlTeamStore.Update", "We couldn't find the existing team to update", "id="+team.Id)
|
||||
} else {
|
||||
@@ -107,7 +107,7 @@ func (s SqlTeamStore) Update(team *model.Team) StoreChannel {
|
||||
team.Name = oldTeam.Name
|
||||
|
||||
if count, err := s.GetMaster().Update(team); err != nil {
|
||||
result.Err = model.NewAppError("SqlTeamStore.Update", "We encounted an error updating the team", "id="+team.Id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlTeamStore.Update", "We encountered an error updating the team", "id="+team.Id+", "+err.Error())
|
||||
} else if count != 1 {
|
||||
result.Err = model.NewAppError("SqlTeamStore.Update", "We couldn't update the team", "id="+team.Id)
|
||||
} else {
|
||||
@@ -149,7 +149,7 @@ func (s SqlTeamStore) Get(id string) StoreChannel {
|
||||
result := StoreResult{}
|
||||
|
||||
if obj, err := s.GetReplica().Get(model.Team{}, id); err != nil {
|
||||
result.Err = model.NewAppError("SqlTeamStore.Get", "We encounted an error finding the team", "id="+id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlTeamStore.Get", "We encountered an error finding the team", "id="+id+", "+err.Error())
|
||||
} else if obj == nil {
|
||||
result.Err = model.NewAppError("SqlTeamStore.Get", "We couldn't find the existing team", "id="+id)
|
||||
} else {
|
||||
@@ -230,7 +230,7 @@ func (s SqlTeamStore) GetTeamsForEmail(email string) StoreChannel {
|
||||
|
||||
var data []*model.Team
|
||||
if _, err := s.GetReplica().Select(&data, "SELECT Teams.* FROM Teams, Users WHERE Teams.Id = Users.TeamId AND Users.Email = :Email", map[string]interface{}{"Email": email}); err != nil {
|
||||
result.Err = model.NewAppError("SqlTeamStore.GetTeamsForEmail", "We encounted a problem when looking up teams", "email="+email+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlTeamStore.GetTeamsForEmail", "We encountered a problem when looking up teams", "email="+email+", "+err.Error())
|
||||
}
|
||||
|
||||
for _, team := range data {
|
||||
|
||||
@@ -118,7 +118,7 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha
|
||||
}
|
||||
|
||||
if oldUserResult, err := us.GetMaster().Get(model.User{}, user.Id); err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.Update", "We encounted an error finding the account", "user_id="+user.Id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlUserStore.Update", "We encountered an error finding the account", "user_id="+user.Id+", "+err.Error())
|
||||
} else if oldUserResult == nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.Update", "We couldn't find the existing account to update", "user_id="+user.Id)
|
||||
} else {
|
||||
@@ -161,7 +161,7 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha
|
||||
} else if IsUniqueConstraintError(err.Error(), "Username", "users_username_teamid_key") {
|
||||
result.Err = model.NewAppError("SqlUserStore.Update", "This username is already taken. Please choose another.", "user_id="+user.Id+", "+err.Error())
|
||||
} else {
|
||||
result.Err = model.NewAppError("SqlUserStore.Update", "We encounted an error updating the account", "user_id="+user.Id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlUserStore.Update", "We encountered an error updating the account", "user_id="+user.Id+", "+err.Error())
|
||||
}
|
||||
} else if count != 1 {
|
||||
result.Err = model.NewAppError("SqlUserStore.Update", "We couldn't update the account", fmt.Sprintf("user_id=%v, count=%v", user.Id, count))
|
||||
@@ -306,7 +306,7 @@ func (us SqlUserStore) Get(id string) StoreChannel {
|
||||
result := StoreResult{}
|
||||
|
||||
if obj, err := us.GetReplica().Get(model.User{}, id); err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.Get", "We encounted an error finding the account", "user_id="+id+", "+err.Error())
|
||||
result.Err = model.NewAppError("SqlUserStore.Get", "We encountered an error finding the account", "user_id="+id+", "+err.Error())
|
||||
} else if obj == nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.Get", "We couldn't find the existing account", "user_id="+id)
|
||||
} else {
|
||||
@@ -351,7 +351,7 @@ func (us SqlUserStore) GetProfiles(teamId string) StoreChannel {
|
||||
var users []*model.User
|
||||
|
||||
if _, err := us.GetReplica().Select(&users, "SELECT * FROM Users WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}); err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.GetProfiles", "We encounted an error while finding user profiles", err.Error())
|
||||
result.Err = model.NewAppError("SqlUserStore.GetProfiles", "We encountered an error while finding user profiles", err.Error())
|
||||
} else {
|
||||
|
||||
userMap := make(map[string]*model.User)
|
||||
@@ -382,7 +382,7 @@ func (us SqlUserStore) GetSystemAdminProfiles() StoreChannel {
|
||||
var users []*model.User
|
||||
|
||||
if _, err := us.GetReplica().Select(&users, "SELECT * FROM Users WHERE Roles = :Roles", map[string]interface{}{"Roles": "system_admin"}); err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.GetSystemAdminProfiles", "We encounted an error while finding user profiles", err.Error())
|
||||
result.Err = model.NewAppError("SqlUserStore.GetSystemAdminProfiles", "We encountered an error while finding user profiles", err.Error())
|
||||
} else {
|
||||
|
||||
userMap := make(map[string]*model.User)
|
||||
@@ -498,7 +498,7 @@ func (us SqlUserStore) GetForExport(teamId string) StoreChannel {
|
||||
var users []*model.User
|
||||
|
||||
if _, err := us.GetReplica().Select(&users, "SELECT * FROM Users WHERE TeamId = :TeamId", map[string]interface{}{"TeamId": teamId}); err != nil {
|
||||
result.Err = model.NewAppError("SqlUserStore.GetProfiles", "We encounted an error while finding user profiles", err.Error())
|
||||
result.Err = model.NewAppError("SqlUserStore.GetProfiles", "We encountered an error while finding user profiles", err.Error())
|
||||
} else {
|
||||
for _, u := range users {
|
||||
u.Password = ""
|
||||
|
||||
Ссылка в новой задаче
Block a user