Commit 49c44b65 authored by Toon Claes's avatar Toon Claes

Merge branch '211394-releases-page-in-not-loading-on-pagination' into 'master'

Filter out Releases with missing tags

Closes #211394

See merge request gitlab-org/gitlab!27716
parents 82923f32 e98d8c69
...@@ -9,7 +9,8 @@ class ReleasesFinder ...@@ -9,7 +9,8 @@ class ReleasesFinder
def execute(preload: true) def execute(preload: true)
return Release.none unless Ability.allowed?(@current_user, :read_release, @project) return Release.none unless Ability.allowed?(@current_user, :read_release, @project)
releases = @project.releases # See https://gitlab.com/gitlab-org/gitlab/-/issues/211988
releases = @project.releases.where.not(tag: nil) # rubocop:disable CodeReuse/ActiveRecord
releases = releases.preloaded if preload releases = releases.preloaded if preload
releases.sorted releases.sorted
end end
......
---
title: Filter out Releases with missing tags
merge_request: 27716
author:
type: fixed
...@@ -52,6 +52,18 @@ describe ReleasesFinder do ...@@ -52,6 +52,18 @@ describe ReleasesFinder do
subject subject
end end
end end
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27716
context 'when tag is nil' do
before do
v1_0_0.update_column(:tag, nil)
end
it 'ignores rows with a nil tag' do
expect(subject.size).to eq(1)
expect(subject).to eq([v1_1_0])
end
end
end end
end end
end end
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