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

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

@@ -916,9 +916,9 @@ func (_m *PostStore) GetRepliesForExport(parentID string) ([]*model.ReplyForExpo
return r0, r1
}
// GetSingle provides a mock function with given fields: id, inclDeleted
func (_m *PostStore) GetSingle(id string, inclDeleted bool) (*model.Post, error) {
ret := _m.Called(id, inclDeleted)
// GetSingle provides a mock function with given fields: rctx, id, inclDeleted
func (_m *PostStore) GetSingle(rctx request.CTX, id string, inclDeleted bool) (*model.Post, error) {
ret := _m.Called(rctx, id, inclDeleted)
if len(ret) == 0 {
panic("no return value specified for GetSingle")
@@ -926,19 +926,19 @@ func (_m *PostStore) GetSingle(id string, inclDeleted bool) (*model.Post, error)
var r0 *model.Post
var r1 error
if rf, ok := ret.Get(0).(func(string, bool) (*model.Post, error)); ok {
return rf(id, inclDeleted)
if rf, ok := ret.Get(0).(func(request.CTX, string, bool) (*model.Post, error)); ok {
return rf(rctx, id, inclDeleted)
}
if rf, ok := ret.Get(0).(func(string, bool) *model.Post); ok {
r0 = rf(id, inclDeleted)
if rf, ok := ret.Get(0).(func(request.CTX, string, bool) *model.Post); ok {
r0 = rf(rctx, id, inclDeleted)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Post)
}
}
if rf, ok := ret.Get(1).(func(string, bool) error); ok {
r1 = rf(id, inclDeleted)
if rf, ok := ret.Get(1).(func(request.CTX, string, bool) error); ok {
r1 = rf(rctx, id, inclDeleted)
} else {
r1 = ret.Error(1)
}