From b212acf312ad640455fa715427ac19e6930dc61d Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Thu, 24 Nov 2016 05:26:45 -0800 Subject: PLT-4429 disabling at_all at_channel metions mentions when channel has more than 1k users (#4627) * PLT-4429 disabling explicit mentions when channel has more than 1k users * Fixing test case * Adding setting to the admin console * Fixing bad translation --- store/sql_channel_store_test.go | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'store/sql_channel_store_test.go') diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go index 8a51d2ae3..6776a438b 100644 --- a/store/sql_channel_store_test.go +++ b/store/sql_channel_store_test.go @@ -384,14 +384,24 @@ func TestChannelMemberStore(t *testing.T) { t.Fatal("Member update time incorrect") } - count := (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64) + count := (<-store.Channel().GetMemberCount(o1.ChannelId, true)).Data.(int64) + if count != 2 { + t.Fatal("should have saved 2 members") + } + + count = (<-store.Channel().GetMemberCount(o1.ChannelId, true)).Data.(int64) + if count != 2 { + t.Fatal("should have saved 2 members") + } + + count = (<-store.Channel().GetMemberCount(o1.ChannelId, false)).Data.(int64) if count != 2 { t.Fatal("should have saved 2 members") } Must(store.Channel().RemoveMember(o2.ChannelId, o2.UserId)) - count = (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64) + count = (<-store.Channel().GetMemberCount(o1.ChannelId, false)).Data.(int64) if count != 1 { t.Fatal("should have removed 1 member") } @@ -463,14 +473,14 @@ func TestChannelDeleteMemberStore(t *testing.T) { t.Fatal("Member update time incorrect") } - count := (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64) + count := (<-store.Channel().GetMemberCount(o1.ChannelId, false)).Data.(int64) if count != 2 { t.Fatal("should have saved 2 members") } Must(store.Channel().PermanentDeleteMembersByUser(o2.UserId)) - count = (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64) + count = (<-store.Channel().GetMemberCount(o1.ChannelId, false)).Data.(int64) if count != 1 { t.Fatal("should have removed 1 member") } @@ -927,7 +937,7 @@ func TestGetMemberCount(t *testing.T) { } Must(store.Channel().SaveMember(&m1)) - if result := <-store.Channel().GetMemberCount(c1.Id); result.Err != nil { + if result := <-store.Channel().GetMemberCount(c1.Id, false); result.Err != nil { t.Fatal("failed to get member count: %v", result.Err) } else if result.Data.(int64) != 1 { t.Fatal("got incorrect member count %v", result.Data) @@ -947,7 +957,7 @@ func TestGetMemberCount(t *testing.T) { } Must(store.Channel().SaveMember(&m2)) - if result := <-store.Channel().GetMemberCount(c1.Id); result.Err != nil { + if result := <-store.Channel().GetMemberCount(c1.Id, false); result.Err != nil { t.Fatal("failed to get member count: %v", result.Err) } else if result.Data.(int64) != 2 { t.Fatal("got incorrect member count %v", result.Data) @@ -968,7 +978,7 @@ func TestGetMemberCount(t *testing.T) { } Must(store.Channel().SaveMember(&m3)) - if result := <-store.Channel().GetMemberCount(c1.Id); result.Err != nil { + if result := <-store.Channel().GetMemberCount(c1.Id, false); result.Err != nil { t.Fatal("failed to get member count: %v", result.Err) } else if result.Data.(int64) != 2 { t.Fatal("got incorrect member count %v", result.Data) @@ -989,7 +999,7 @@ func TestGetMemberCount(t *testing.T) { } Must(store.Channel().SaveMember(&m4)) - if result := <-store.Channel().GetMemberCount(c1.Id); result.Err != nil { + if result := <-store.Channel().GetMemberCount(c1.Id, false); result.Err != nil { t.Fatal("failed to get member count: %v", result.Err) } else if result.Data.(int64) != 2 { t.Fatal("got incorrect member count %v", result.Data) -- cgit v1.2.3-1-g7c22