diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-10-05 12:45:15 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-10-13 09:42:25 -0400 |
commit | a11421c74b338eee6eedb4f4260a75f38aa3fd4c (patch) | |
tree | 9d2f3110eb88b28c7ad11f00a415319508eca8b3 /api/preference.go | |
parent | 599644fb2fa75d1760420806c8c821959fc6b645 (diff) | |
download | chat-a11421c74b338eee6eedb4f4260a75f38aa3fd4c.tar.gz chat-a11421c74b338eee6eedb4f4260a75f38aa3fd4c.tar.bz2 chat-a11421c74b338eee6eedb4f4260a75f38aa3fd4c.zip |
Added default direct channels for previously existing users
Diffstat (limited to 'api/preference.go')
-rw-r--r-- | api/preference.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/api/preference.go b/api/preference.go index 9fadfd2e4..84cfc130c 100644 --- a/api/preference.go +++ b/api/preference.go @@ -58,6 +58,15 @@ func getPreferencesByName(c *Context, w http.ResponseWriter, r *http.Request) { c.Err = result.Err return } else { - w.Write([]byte(model.PreferenceListToJson(result.Data.([]*model.Preference)))) + data := result.Data.([]*model.Preference) + + if len(data) == 0 { + if category == model.PREFERENCE_CATEGORY_DIRECT_CHANNELS && name == model.PREFERENCE_NAME_SHOW { + // add direct channels for a user that existed before preferences were added + data = AddDirectChannels(c.Session.UserId, c.Session.TeamId) + } + } + + w.Write([]byte(model.PreferenceListToJson(data))) } } |