MM-58038: Use context to call master for DeletePost (#27098)

Calling app.DeletePost immediately after creating a post
is susceptible to replica lag because we were calling the
replica to check for the post.

We fix this by passing a context to always query master.

https://mattermost.atlassian.net/browse/MM-58038

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2024-05-24 19:35:48 +05:30
коммит произвёл GitHub
родитель 09c0eb7e7a
Коммит 6f3327ce0f
34 изменённых файлов: 94 добавлений и 93 удалений

Просмотреть файл

@@ -2700,7 +2700,7 @@ func (a *App) MarkChannelAsUnreadFromPost(c request.CTX, postID string, userID s
if !collapsedThreadsSupported || !a.IsCRTEnabledForUser(c, userID) {
return a.markChannelAsUnreadFromPostCRTUnsupported(c, postID, userID)
}
post, err := a.GetSinglePost(postID, false)
post, err := a.GetSinglePost(c, postID, false)
if err != nil {
return nil, err
}
@@ -2727,7 +2727,7 @@ func (a *App) MarkChannelAsUnreadFromPost(c request.CTX, postID string, userID s
}
func (a *App) markChannelAsUnreadFromPostCRTUnsupported(c request.CTX, postID string, userID string) (*model.ChannelUnreadAt, *model.AppError) {
post, appErr := a.GetSinglePost(postID, false)
post, appErr := a.GetSinglePost(c, postID, false)
if appErr != nil {
return nil, appErr
}
@@ -2766,7 +2766,7 @@ func (a *App) markChannelAsUnreadFromPostCRTUnsupported(c request.CTX, postID st
// If there are replies with mentions below the marked reply in the thread, then sum the mentions for the threads mention badge.
// In CRT Unsupported Client: Channel is marked as unread and new messages line inserted above the marked post.
// Badge on channel sums mentions in all posts (root & replies) including and below the post that was marked unread.
rootPost, appErr := a.GetSinglePost(post.RootId, false)
rootPost, appErr := a.GetSinglePost(c, post.RootId, false)
if appErr != nil {
return nil, appErr
}