summaryrefslogtreecommitdiffstats
path: root/api/channel.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2016-12-20 16:55:22 +0100
committerCorey Hulen <corey@hulen.com>2016-12-20 07:55:22 -0800
commitb9092ca2f56b0fa2b8ec7719c2ec5cfe5a21a6c9 (patch)
treef9d8a0aee0937acca727786db077fa38039304db /api/channel.go
parent92b2810d84bda78b87f23d5e3d8d04de1c3d9125 (diff)
downloadchat-b9092ca2f56b0fa2b8ec7719c2ec5cfe5a21a6c9.tar.gz
chat-b9092ca2f56b0fa2b8ec7719c2ec5cfe5a21a6c9.tar.bz2
chat-b9092ca2f56b0fa2b8ec7719c2ec5cfe5a21a6c9.zip
Fix API Get channels for a user returns users' dm channels with blank teamid (#4748)
* fix API Get channels for a user returns users' dm channels with blank team ID add check in the context.go add suggestion made adjustment per review and support from @joram * update tests * add check if needd user or admin permissions * update per review
Diffstat (limited to 'api/channel.go')
-rw-r--r--api/channel.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/api/channel.go b/api/channel.go
index dcc4ed563..941692ac3 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -431,10 +431,13 @@ func updateChannelPurpose(c *Context, w http.ResponseWriter, r *http.Request) {
}
func getChannels(c *Context, w http.ResponseWriter, r *http.Request) {
-
+ if c.TeamId == "" {
+ c.Err = model.NewLocAppError("", "api.context.missing_teamid.app_error", nil, "TeamIdRequired")
+ c.Err.StatusCode = http.StatusBadRequest
+ return
+ }
// user is already in the team
// Get's all channels the user is a member of
-
if result := <-Srv.Store.Channel().GetChannels(c.TeamId, c.Session.UserId); result.Err != nil {
if result.Err.Id == "store.sql_channel.get_channels.not_found.app_error" {
// lets make sure the user is valid