Making InvalidateCacheForUser public again (#13997)

This commit is contained in:
Jesús Espino
2020-03-04 16:16:27 +01:00
committed by GitHub
parent 3c8a5f863b
commit 54bb6d10f3
4 changed files with 20 additions and 20 deletions

View File

@@ -254,7 +254,7 @@ func (a *App) CreateChannel(channel *model.Channel, addMember bool) (*model.Chan
return nil, err
}
a.invalidateCacheForUser(channel.CreatorId)
a.InvalidateCacheForUser(channel.CreatorId)
}
if pluginsEnvironment := a.GetPluginsEnvironment(); pluginsEnvironment != nil {
@@ -301,8 +301,8 @@ func (a *App) GetOrCreateDirectChannel(userId, otherUserId string) (*model.Chann
a.WaitForChannelMembership(channel.Id, userId)
a.invalidateCacheForUser(userId)
a.invalidateCacheForUser(otherUserId)
a.InvalidateCacheForUser(userId)
a.InvalidateCacheForUser(otherUserId)
if pluginsEnvironment := a.GetPluginsEnvironment(); pluginsEnvironment != nil {
a.Srv().Go(func() {
@@ -424,7 +424,7 @@ func (a *App) CreateGroupChannel(userIds []string, creatorId string) (*model.Cha
a.WaitForChannelMembership(channel.Id, creatorId)
}
a.invalidateCacheForUser(userId)
a.InvalidateCacheForUser(userId)
}
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_GROUP_ADDED, "", channel.Id, "", nil)
@@ -777,7 +777,7 @@ func (a *App) UpdateChannelMemberRoles(channelId string, userId string, newRoles
return nil, err
}
a.invalidateCacheForUser(userId)
a.InvalidateCacheForUser(userId)
return member, nil
}
@@ -810,7 +810,7 @@ func (a *App) UpdateChannelMemberSchemeRoles(channelId string, userId string, is
message.Add("channelMember", member.ToJson())
a.Publish(message)
a.invalidateCacheForUser(userId)
a.InvalidateCacheForUser(userId)
return member, nil
}
@@ -847,7 +847,7 @@ func (a *App) UpdateChannelMemberNotifyProps(data map[string]string, channelId s
return nil, err
}
a.invalidateCacheForUser(userId)
a.InvalidateCacheForUser(userId)
a.invalidateCacheForChannelMembersNotifyProps(channelId)
// Notify the clients that the member notify props changed
evt := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_MEMBER_UPDATED, "", "", userId, nil)
@@ -1003,7 +1003,7 @@ func (a *App) addUserToChannel(user *model.User, channel *model.Channel, teamMem
return nil, err
}
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
a.invalidateCacheForChannelMembers(channel.Id)
return newMember, nil
@@ -1735,7 +1735,7 @@ func (a *App) removeUserFromChannel(userIdToRemove string, removerUserId string,
}
}
a.invalidateCacheForUser(userIdToRemove)
a.InvalidateCacheForUser(userIdToRemove)
a.invalidateCacheForChannelMembers(channel.Id)
if pluginsEnvironment := a.GetPluginsEnvironment(); pluginsEnvironment != nil {

View File

@@ -647,7 +647,7 @@ func (a *App) JoinUserToTeam(team *model.Team, user *model.User, userRequestorId
}
a.ClearSessionCacheForUser(user.Id)
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
a.invalidateCacheForUserTeams(user.Id)
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_ADDED_TO_TEAM, "", "", user.Id, nil)
@@ -963,7 +963,7 @@ func (a *App) RemoveTeamMemberFromTeam(teamMember *model.TeamMember, requestorId
}
a.ClearSessionCacheForUser(user.Id)
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
a.invalidateCacheForUserTeams(user.Id)
return nil

View File

@@ -838,7 +838,7 @@ func (a *App) SetDefaultProfileImage(user *model.User) *model.AppError {
mlog.Error("Failed to reset last picture update", mlog.Err(err))
}
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
updatedUser, appErr := a.GetUser(user.Id)
if appErr != nil {
@@ -1010,7 +1010,7 @@ func (a *App) UpdateActive(user *model.User, active bool) (*model.User, *model.A
}
a.invalidateUserChannelMembersCaches(user.Id)
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
a.sendUpdatedUserEvent(*ruser)
@@ -1191,7 +1191,7 @@ func (a *App) UpdateUser(user *model.User, sendNotifications bool) (*model.User,
}
}
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
if a.IsESIndexingEnabled() {
a.Srv().Go(func() {
@@ -1437,7 +1437,7 @@ func (a *App) UpdateUserRoles(userId string, newRoles string, sendWebSocketEvent
mlog.Error("Failed during updating user roles", mlog.Err(result.Err))
}
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
a.ClearSessionCacheForUser(user.Id)
if sendWebSocketEvent {
@@ -2043,7 +2043,7 @@ func (a *App) UpdateOAuthUserAttrs(userData io.Reader, user *model.User, provide
}
user = users.New
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
if a.IsESIndexingEnabled() {
a.Srv().Go(func() {
@@ -2253,7 +2253,7 @@ func (a *App) getListOfAllowedChannelsForTeam(teamId string, viewRestrictions *m
// guest roles to regular user roles.
func (a *App) PromoteGuestToUser(user *model.User, requestorId string) *model.AppError {
err := a.Srv().Store.User().PromoteGuestToUser(user.Id)
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
if err != nil {
return err
}
@@ -2307,7 +2307,7 @@ func (a *App) PromoteGuestToUser(user *model.User, requestorId string) *model.Ap
// regular user roles to guest roles.
func (a *App) DemoteUserToGuest(user *model.User) *model.AppError {
err := a.Srv().Store.User().DemoteUserToGuest(user.Id)
a.invalidateCacheForUser(user.Id)
a.InvalidateCacheForUser(user.Id)
if err != nil {
return err
}
@@ -2349,7 +2349,7 @@ func (a *App) DemoteUserToGuest(user *model.User) *model.AppError {
// invalidateUserCacheAndPublish Invalidates cache for a user and publishes user updated event
func (a *App) invalidateUserCacheAndPublish(userId string) {
a.invalidateCacheForUser(userId)
a.InvalidateCacheForUser(userId)
user, userErr := a.GetUser(userId)
if userErr != nil {

View File

@@ -269,7 +269,7 @@ func (a *App) invalidateCacheForChannelPosts(channelId string) {
a.Srv().Store.Post().InvalidateLastPostTimeCache(channelId)
}
func (a *App) invalidateCacheForUser(userId string) {
func (a *App) InvalidateCacheForUser(userId string) {
a.invalidateCacheForUserSkipClusterSend(userId)
a.Srv().Store.User().InvalidateProfilesInChannelCacheByUser(userId)