From fc0b422c37f719a350b65e064cde7b506a88052e Mon Sep 17 00:00:00 2001 From: hmhealey Date: Sat, 23 Jan 2016 13:13:34 -0500 Subject: Changed GetMemberCount to stop including inactive users --- store/sql_channel_store.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'store/sql_channel_store.go') diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index 336398ae7..7400df8d2 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -582,7 +582,16 @@ func (s SqlChannelStore) GetMemberCount(channelId string) StoreChannel { go func() { result := StoreResult{} - count, err := s.GetReplica().SelectInt("SELECT count(*) FROM ChannelMembers WHERE ChannelId = :ChannelId", map[string]interface{}{"ChannelId": channelId}) + count, err := s.GetReplica().SelectInt(` + SELECT + count(*) + FROM + ChannelMembers, + Users + WHERE + ChannelMembers.UserId = Users.Id + AND ChannelMembers.ChannelId = :ChannelId + AND Users.DeleteAt = 0`, map[string]interface{}{"ChannelId": channelId}) if err != nil { result.Err = model.NewAppError("SqlChannelStore.GetMemberCount", "We couldn't get the channel member count", "channel_id="+channelId+", "+err.Error()) } else { -- cgit v1.2.3-1-g7c22