[MM-33603] Fix nil dereference panic in (*App).CreatePost() (#17124)
* Fix possible nil dereference * fixed nil dereference for unfollowed thread Co-authored-by: Eli Yukelzon <reflog@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cee7f8ba4e
Коммит
f0ccaa89bf
@@ -437,11 +437,16 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
||||
}
|
||||
if sendEvent {
|
||||
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_THREAD_UPDATED, team.Id, "", uid, nil)
|
||||
userThread, _ := a.Srv().Store.Thread().GetThreadForUser(uid, channel.TeamId, thread.PostId, true)
|
||||
a.sanitizeProfiles(userThread.Participants, false)
|
||||
userThread.Post.SanitizeProps()
|
||||
message.Add("thread", userThread.ToJson())
|
||||
a.Publish(message)
|
||||
userThread, err := a.Srv().Store.Thread().GetThreadForUser(uid, channel.TeamId, thread.PostId, true)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot get thread %q for user %q", thread.PostId, uid)
|
||||
}
|
||||
if userThread != nil {
|
||||
a.sanitizeProfiles(userThread.Participants, false)
|
||||
userThread.Post.SanitizeProps()
|
||||
message.Add("thread", userThread.ToJson())
|
||||
a.Publish(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user