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/channel.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/channel.go')
-rw-r--r-- | api/channel.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/api/channel.go b/api/channel.go index ea39ee398..9ec556fe6 100644 --- a/api/channel.go +++ b/api/channel.go @@ -580,7 +580,7 @@ func AddUserToChannel(user *model.User, channel *model.Channel) (*model.ChannelM go func() { InvalidateCacheForUser(user.Id) - Srv.Store.User().InvalidateProfilesInChannelCache(channel.Id) + InvalidateCacheForChannel(channel.Id) message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_USER_ADDED, "", channel.Id, "", nil) message.Add("user_id", user.Id) @@ -625,7 +625,7 @@ func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *m l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err) } - Srv.Store.User().InvalidateProfilesInChannelCache(result.Data.(*model.Channel).Id) + InvalidateCacheForChannel(result.Data.(*model.Channel).Id) } if result := <-Srv.Store.Channel().GetByName(teamId, "off-topic"); result.Err != nil { @@ -649,7 +649,7 @@ func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *m l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err) } - Srv.Store.User().InvalidateProfilesInChannelCache(result.Data.(*model.Channel).Id) + InvalidateCacheForChannel(result.Data.(*model.Channel).Id) } return err @@ -662,7 +662,7 @@ func leave(c *Context, w http.ResponseWriter, r *http.Request) { sc := Srv.Store.Channel().Get(id) uc := Srv.Store.User().Get(c.Session.UserId) - ccm := Srv.Store.Channel().GetMemberCount(id) + ccm := Srv.Store.Channel().GetMemberCount(id, false) if cresult := <-sc; cresult.Err != nil { c.Err = cresult.Err @@ -718,7 +718,7 @@ func deleteChannel(c *Context, w http.ResponseWriter, r *http.Request) { sc := Srv.Store.Channel().Get(id) scm := Srv.Store.Channel().GetMember(id, c.Session.UserId) - cmc := Srv.Store.Channel().GetMemberCount(id) + cmc := Srv.Store.Channel().GetMemberCount(id, false) uc := Srv.Store.User().Get(c.Session.UserId) ihc := Srv.Store.Webhook().GetIncomingByChannel(id) ohc := Srv.Store.Webhook().GetOutgoingByChannel(id) @@ -949,7 +949,7 @@ func getChannelStats(c *Context, w http.ResponseWriter, r *http.Request) { channel = result.Data.(*model.Channel) } - if result := <-Srv.Store.Channel().GetMemberCount(id); result.Err != nil { + if result := <-Srv.Store.Channel().GetMemberCount(id, true); result.Err != nil { c.Err = result.Err return } else { @@ -1107,7 +1107,6 @@ func removeMember(c *Context, w http.ResponseWriter, r *http.Request) { w.Write([]byte(model.MapToJson(result))) } } - } func RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError { @@ -1120,7 +1119,7 @@ func RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel } InvalidateCacheForUser(userIdToRemove) - Srv.Store.User().InvalidateProfilesInChannelCache(channel.Id) + InvalidateCacheForChannel(channel.Id) message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_USER_REMOVED, "", channel.Id, "", nil) message.Add("user_id", userIdToRemove) |