[MM-45726] Fix Sentry crash: nil deference in app/post_helpers.go:85 (#20654)
* Avoid adding duplicate post
Этот коммит содержится в:
@@ -784,6 +784,13 @@ func (s *SqlPostStore) Get(ctx context.Context, id string, opts model.GetPostsOp
|
||||
}
|
||||
|
||||
for _, p := range posts {
|
||||
if p.Id == id {
|
||||
// Based on the conditions above such as sq.Or{ sq.Eq{"p.Id": rootId}, sq.Eq{"p.RootId": rootId}, }
|
||||
// posts may contain the "id" post which has already been fetched and added in the "pl"
|
||||
// So, skip the "id" to avoid duplicate entry of the post
|
||||
continue
|
||||
}
|
||||
|
||||
pl.AddPost(p)
|
||||
pl.AddOrder(p.Id)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user