diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-10-07 10:39:36 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-10-13 09:42:26 -0400 |
commit | ed6b2cd164b249c67db0e0421cc78964450240c9 (patch) | |
tree | 0ced893f1d20cfb3d92d646374fcd2ec0f6940e0 /api/user.go | |
parent | a6cd2a79612d6d96e0e929ab769ec5e70cd35f5f (diff) | |
download | chat-ed6b2cd164b249c67db0e0421cc78964450240c9.tar.gz chat-ed6b2cd164b249c67db0e0421cc78964450240c9.tar.bz2 chat-ed6b2cd164b249c67db0e0421cc78964450240c9.zip |
Removed setting direct channels for a new user at creation time
Diffstat (limited to 'api/user.go')
-rw-r--r-- | api/user.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/api/user.go b/api/user.go index 204f00dcd..faf828cf9 100644 --- a/api/user.go +++ b/api/user.go @@ -198,8 +198,6 @@ 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) } - fireAndForgetAddDirectChannels(ruser, team) - fireAndForgetWelcomeEmail(ruser.Email, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team)) if user.EmailVerified { if cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil { @@ -220,53 +218,6 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User { } } -func fireAndForgetAddDirectChannels(user *model.User, team *model.Team) { - go func() { - AddDirectChannels(user.Id, team.Id) - }() -} - -func AddDirectChannels(userId, teamId string) []*model.Preference { - var profiles map[string]*model.User - if result := <-Srv.Store.User().GetProfiles(teamId); result.Err != nil { - l4g.Error("Failed to add direct channel preferences for user user_id=%s, team_id=%s, err=%v", userId, teamId, result.Err.Error()) - return []*model.Preference{} - } else { - profiles = result.Data.(map[string]*model.User) - } - - var preferences []*model.Preference - - for id := range profiles { - if id == userId { - continue - } - - profile := profiles[id] - - preference := &model.Preference{ - UserId: userId, - Category: model.PREFERENCE_CATEGORY_DIRECT_CHANNELS, - Name: model.PREFERENCE_NAME_SHOW, - AltId: profile.Id, - Value: "true", - } - - if result := <-Srv.Store.Preference().Save(preference); result.Err != nil { - l4g.Error("Failed to add direct channel preferences for user user_id=%s, alt_id=%s, team_id=%s, err=%v", userId, profile.Id, teamId, result.Err.Error()) - continue - } - - preferences = append(preferences, preference) - - if len(preferences) >= 10 { - break - } - } - - return preferences -} - func fireAndForgetWelcomeEmail(email, teamDisplayName, siteURL, teamURL string) { go func() { |