diff --git a/server/channels/app/post.go b/server/channels/app/post.go index 2bb98a5b4a..3def93614a 100644 --- a/server/channels/app/post.go +++ b/server/channels/app/post.go @@ -489,7 +489,10 @@ func (a *App) handlePostEvents(c request.CTX, post *model.Post, user *model.User } a.Srv().Platform().InvalidateCacheForChannel(channel) - a.invalidateCacheForChannelPosts(channel.Id) + if post.IsPinned { + a.Srv().Store().Channel().InvalidatePinnedPostCount(channel.Id) + } + a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id) if _, err := a.SendNotifications(c, post, team, channel, user, parentPostList, setOnline); err != nil { return err diff --git a/server/channels/app/post_acknowledgements.go b/server/channels/app/post_acknowledgements.go index 0ca509ef9d..d5c9f755f0 100644 --- a/server/channels/app/post_acknowledgements.go +++ b/server/channels/app/post_acknowledgements.go @@ -46,11 +46,9 @@ func (a *App) SaveAcknowledgementForPost(c request.CTX, postID, userID string) ( } // The post is always modified since the UpdateAt always changes - a.invalidateCacheForChannelPosts(channel.Id) + a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id) - a.Srv().Go(func() { - a.sendAcknowledgementEvent(model.WebsocketEventAcknowledgementAdded, acknowledgement, post) - }) + a.sendAcknowledgementEvent(model.WebsocketEventAcknowledgementAdded, acknowledgement, post) return acknowledgement, nil } @@ -92,11 +90,9 @@ func (a *App) DeleteAcknowledgementForPost(c request.CTX, postID, userID string) } // The post is always modified since the UpdateAt always changes - a.invalidateCacheForChannelPosts(channel.Id) + a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id) - a.Srv().Go(func() { - a.sendAcknowledgementEvent(model.WebsocketEventAcknowledgementRemoved, oldAck, post) - }) + a.sendAcknowledgementEvent(model.WebsocketEventAcknowledgementRemoved, oldAck, post) return nil } diff --git a/server/channels/app/reaction.go b/server/channels/app/reaction.go index 449ed3aab8..2a46fda2af 100644 --- a/server/channels/app/reaction.go +++ b/server/channels/app/reaction.go @@ -71,7 +71,7 @@ func (a *App) SaveReactionForPost(c request.CTX, reaction *model.Reaction) (*mod } // The post is always modified since the UpdateAt always changes - a.invalidateCacheForChannelPosts(post.ChannelId) + a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id) pluginContext := pluginContext(c) a.Srv().Go(func() { @@ -144,7 +144,7 @@ func (a *App) DeleteReactionForPost(c request.CTX, reaction *model.Reaction) *mo } // The post is always modified since the UpdateAt always changes - a.invalidateCacheForChannelPosts(post.ChannelId) + a.Srv().Store().Post().InvalidateLastPostTimeCache(channel.Id) pluginContext := pluginContext(c) a.Srv().Go(func() {