summaryrefslogtreecommitdiffstats
path: root/api/preference.go
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-10-05 12:45:15 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-10-13 09:42:25 -0400
commita11421c74b338eee6eedb4f4260a75f38aa3fd4c (patch)
tree9d2f3110eb88b28c7ad11f00a415319508eca8b3 /api/preference.go
parent599644fb2fa75d1760420806c8c821959fc6b645 (diff)
downloadchat-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.go11
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)))
}
}