summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/app/channel.go b/app/channel.go
index 1844e3177..c9199f829 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -88,7 +88,7 @@ func CreateDefaultChannels(teamId string) ([]*model.Channel, *model.AppError) {
func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *model.AppError {
var err *model.AppError = nil
- if result := <-Srv.Store.Channel().GetByName(teamId, "town-square"); result.Err != nil {
+ if result := <-Srv.Store.Channel().GetByName(teamId, "town-square", true); result.Err != nil {
err = result.Err
} else {
cm := &model.ChannelMember{ChannelId: result.Data.(*model.Channel).Id, UserId: user.Id,
@@ -105,14 +105,14 @@ func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *m
UserId: user.Id,
}
- InvalidateCacheForChannel(result.Data.(*model.Channel).Id)
+ InvalidateCacheForChannelMembers(result.Data.(*model.Channel).Id)
if _, err := CreatePost(post, teamId, false); err != nil {
l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
}
}
- if result := <-Srv.Store.Channel().GetByName(teamId, "off-topic"); result.Err != nil {
+ if result := <-Srv.Store.Channel().GetByName(teamId, "off-topic", true); result.Err != nil {
err = result.Err
} else {
cm := &model.ChannelMember{ChannelId: result.Data.(*model.Channel).Id, UserId: user.Id,
@@ -129,7 +129,7 @@ func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *m
UserId: user.Id,
}
- InvalidateCacheForChannel(result.Data.(*model.Channel).Id)
+ InvalidateCacheForChannelMembers(result.Data.(*model.Channel).Id)
if _, err := CreatePost(post, teamId, false); err != nil {
l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
@@ -195,7 +195,7 @@ func UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError) {
if result := <-Srv.Store.Channel().Update(channel); result.Err != nil {
return nil, result.Err
} else {
- InvalidateCacheForChannel(channel.Id)
+ InvalidateCacheForChannel(channel)
return channel, nil
}
}
@@ -287,6 +287,7 @@ func DeleteChannel(channel *model.Channel, userId string) *model.AppError {
if result := <-Srv.Store.Webhook().DeleteIncoming(hook.Id, now); result.Err != nil {
l4g.Error(utils.T("api.channel.delete_channel.incoming_webhook.error"), hook.Id)
}
+ InvalidateCacheForWebhook(hook.Id)
}
for _, hook := range outgoingHooks {
@@ -298,7 +299,7 @@ func DeleteChannel(channel *model.Channel, userId string) *model.AppError {
if dresult := <-Srv.Store.Channel().Delete(channel.Id, model.GetMillis()); dresult.Err != nil {
return dresult.Err
}
- InvalidateCacheForChannel(channel.Id)
+ InvalidateCacheForChannel(channel)
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_DELETED, channel.TeamId, "", "", nil)
message.Add("channel_id", channel.Id)
@@ -351,7 +352,7 @@ func AddUserToChannel(user *model.User, channel *model.Channel) (*model.ChannelM
}
InvalidateCacheForUser(user.Id)
- InvalidateCacheForChannel(channel.Id)
+ InvalidateCacheForChannelMembers(channel.Id)
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_USER_ADDED, "", channel.Id, "", nil)
message.Add("user_id", user.Id)
@@ -508,7 +509,7 @@ func GetChannel(channelId string) (*model.Channel, *model.AppError) {
}
func GetChannelByName(channelName, teamId string) (*model.Channel, *model.AppError) {
- if result := <-Srv.Store.Channel().GetByName(teamId, channelName); result.Err != nil {
+ if result := <-Srv.Store.Channel().GetByName(teamId, channelName, true); result.Err != nil {
return nil, result.Err
} else {
return result.Data.(*model.Channel), nil
@@ -650,7 +651,7 @@ func RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel
}
InvalidateCacheForUser(userIdToRemove)
- InvalidateCacheForChannel(channel.Id)
+ InvalidateCacheForChannelMembers(channel.Id)
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_USER_REMOVED, "", channel.Id, "", nil)
message.Add("user_id", userIdToRemove)