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 удалений

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

@@ -2723,7 +2723,7 @@ func (a *App) UpdateThreadFollowForUserFromChannelAdd(c request.CTX, userID, tea
return model.NewAppError("UpdateThreadFollowForUserFromChannelAdd", "app.user.update_thread_follow_for_user.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
post, appErr := a.GetSinglePost(threadID, false)
post, appErr := a.GetSinglePost(c, threadID, false)
if appErr != nil {
return appErr
}
@@ -2772,7 +2772,7 @@ func (a *App) UpdateThreadFollowForUserFromChannelAdd(c request.CTX, userID, tea
}
func (a *App) UpdateThreadReadForUserByPost(c request.CTX, currentSessionId, userID, teamID, threadID, postID string) (*model.ThreadResponse, *model.AppError) {
post, err := a.GetSinglePost(postID, false)
post, err := a.GetSinglePost(c, postID, false)
if err != nil {
return nil, err
}
@@ -2805,7 +2805,7 @@ func (a *App) UpdateThreadReadForUser(c request.CTX, currentSessionId, userID, t
return nil, model.NewAppError("UpdateThreadReadForUser", "app.user.update_thread_read_for_user.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr)
}
post, err := a.GetSinglePost(threadID, false)
post, err := a.GetSinglePost(c, threadID, false)
if err != nil {
return nil, err
}