Fix pipeline index json Gitaly N+1 with `latest?`
What does this MR do?
This MR fixes pipeline index json Gitaly N+1 related to checking if a pipeline is the latest one of a given branch, through a call to Ci::Pipeline#latest?
.
Gitaly work that was needed can be found in gitaly!2269 (merged)
Conformity
Related issues
Closes #19697 (closed)
Edited by Grzegorz Bizon