diff options
author | Corey Hulen <corey@hulen.com> | 2016-11-24 05:26:45 -0800 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-11-24 08:26:45 -0500 |
commit | b212acf312ad640455fa715427ac19e6930dc61d (patch) | |
tree | 8fb977e00bef33587c3199ad3617417b27fb6b8a /api/web_conn.go | |
parent | 0f07a2d288bada5e08cd9a63047ee85ef60738f5 (diff) | |
download | chat-b212acf312ad640455fa715427ac19e6930dc61d.tar.gz chat-b212acf312ad640455fa715427ac19e6930dc61d.tar.bz2 chat-b212acf312ad640455fa715427ac19e6930dc61d.zip |
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
Diffstat (limited to 'api/web_conn.go')
-rw-r--r-- | api/web_conn.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/api/web_conn.go b/api/web_conn.go index f145950b3..a2b801904 100644 --- a/api/web_conn.go +++ b/api/web_conn.go @@ -187,6 +187,18 @@ func (webCon *WebConn) ShouldSendEvent(msg *model.WebSocketEvent) bool { // Only report events to users who are in the channel for the event if len(msg.Broadcast.ChannelId) > 0 { + // Only broadcast typing messages if less than 1K people in channel + if msg.Event == model.WEBSOCKET_EVENT_TYPING { + if result := <-Srv.Store.Channel().GetMemberCount(msg.Broadcast.ChannelId, true); result.Err != nil { + l4g.Error("webhub.shouldSendEvent: " + result.Err.Error()) + return false + } else { + if result.Data.(int64) > *utils.Cfg.TeamSettings.MaxNotificationsPerChannel { + return false + } + } + } + if model.GetMillis()-webCon.LastAllChannelMembersTime > 1000*60*15 { // 15 minutes webCon.AllChannelMembers = nil webCon.LastAllChannelMembersTime = 0 |