Commit 00493319 authored by Michał Zając's avatar Michał Zając

Reuse Ci::Pipeline.newest_first method

parent d476de65
......@@ -151,9 +151,8 @@ class Vulnerability < ApplicationRecord
# See https://gitlab.com/gitlab-org/gitlab/-/issues/218012
latest_successful_pipeline = project
.ci_pipelines
.for_ref(project.default_branch)
.where(status: :success)
.order(created_at: :desc)
.newest_first(ref: project.default_branch, limit: 10)
.success
.find { |pipeline| pipeline.builds.any? { |build| build.name == self.report_type } }
# Technically this shouldn't ever happen.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment