summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/channel.go7
-rw-r--r--api/channel_test.go4
2 files changed, 10 insertions, 1 deletions
diff --git a/api/channel.go b/api/channel.go
index 44be1cf97..75ca9680d 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -707,6 +707,7 @@ func getChannelExtraInfo(c *Context, w http.ResponseWriter, r *http.Request) {
scm := Srv.Store.Channel().GetMember(id, c.Session.UserId)
ecm := Srv.Store.Channel().GetExtraMembers(id, 20)
+ ccm := Srv.Store.Channel().GetMemberCount(id)
if cmresult := <-scm; cmresult.Err != nil {
c.Err = cmresult.Err
@@ -714,9 +715,13 @@ func getChannelExtraInfo(c *Context, w http.ResponseWriter, r *http.Request) {
} else if ecmresult := <-ecm; ecmresult.Err != nil {
c.Err = ecmresult.Err
return
+ } else if ccmresult := <-ccm; ccmresult.Err != nil {
+ c.Err = ccmresult.Err
+ return
} else {
member := cmresult.Data.(model.ChannelMember)
extraMembers := ecmresult.Data.([]model.ExtraMember)
+ memberCount := ccmresult.Data.(int64)
if !c.HasPermissionsToTeam(channel.TeamId, "getChannelExtraInfo") {
return
@@ -732,7 +737,7 @@ func getChannelExtraInfo(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- data := model.ChannelExtra{Id: channel.Id, Members: extraMembers}
+ data := model.ChannelExtra{Id: channel.Id, Members: extraMembers, MemberCount: memberCount}
w.Header().Set(model.HEADER_ETAG_SERVER, extraEtag)
w.Header().Set("Expires", "-1")
w.Write([]byte(data.ToJson()))
diff --git a/api/channel_test.go b/api/channel_test.go
index a41f63b1b..faed387dd 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -677,6 +677,10 @@ func TestGetChannelExtraInfo(t *testing.T) {
data := rget.Data.(*model.ChannelExtra)
if data.Id != channel1.Id {
t.Fatal("couldnt't get extra info")
+ } else if len(data.Members) != 1 {
+ t.Fatal("got incorrect members")
+ } else if data.MemberCount != 1 {
+ t.Fatal("got incorrect member count")
}
//