MM-49546: Sentry crash: fix nil pointer dereference (#22018)
We return a store error always to be handled correctly at the app layer. https://mattermost.atlassian.net/browse/MM-49546 ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d27d7bc8f7
Коммит
079f752478
@@ -2409,10 +2409,17 @@ func TestFollowThreadSkipsParticipants(t *testing.T) {
|
||||
require.True(t, p.Id == sysadmin.Id || p.Id == user.Id)
|
||||
}
|
||||
|
||||
oldID := threadMembership.PostId
|
||||
threadMembership.PostId = "notfound"
|
||||
_, err = th.App.GetThreadForUser(threadMembership, false)
|
||||
require.NotNil(t, err)
|
||||
assert.Equal(t, http.StatusNotFound, err.StatusCode)
|
||||
|
||||
threadMembership.Following = false
|
||||
threadMembership.PostId = oldID
|
||||
_, err = th.App.GetThreadForUser(threadMembership, false)
|
||||
require.NotNil(t, err)
|
||||
assert.Equal(t, http.StatusNotFound, err.StatusCode)
|
||||
}
|
||||
|
||||
func TestAutofollowBasedOnRootPost(t *testing.T) {
|
||||
|
||||
@@ -503,7 +503,7 @@ func (s *SqlThreadStore) GetThreadFollowers(threadID string, fetchOnlyActive boo
|
||||
|
||||
func (s *SqlThreadStore) GetThreadForUser(threadMembership *model.ThreadMembership, extended, postPriorityEnabled bool) (*model.ThreadResponse, error) {
|
||||
if !threadMembership.Following {
|
||||
return nil, nil // in case the thread is not followed anymore - return nil error to be interpreted as 404
|
||||
return nil, store.NewErrNotFound("ThreadMembership", "<following>")
|
||||
}
|
||||
|
||||
unreadRepliesQuery := sq.
|
||||
|
||||
Ссылка в новой задаче
Block a user