-
Stan Hu authored
In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56987, we lost the N+1 query optimizations used for legacy stages that were fixed by https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21000. To fix this issue, we use a similar approach used by that older merge request and preload the statuses dynamically using a `StagePresenter`. This dynamic preloading is necessary to filter out `GenericCommitStatus`, which does not have a tags association. Note that we the newly-introduced `with_latest_and_retried_statuses` scope in the `Ci::Stage` model was just making extraneous queries that weren't being used. This happend because `_stage.html.haml` previously called `latest_statuses` and `retried_statuses` scopes, which actually wiped out any included assocations for stages. Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/329417 Changelog: fixed
035856f8