diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-10 18:11:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-10 18:11:01 +0300 |
commit | ae1b3d982482280f22a907faba2c9ba02f4d1db1 (patch) | |
tree | 5c3312879a2c554e1e73a175878ea7eb7a87ac10 /app/models | |
parent | e1bfa7aef2346a8c2d4e0ae0c69bf7649896f556 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 6 | ||||
-rw-r--r-- | app/models/issue.rb | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 4dffaa06364..f8b3777841d 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -90,6 +90,12 @@ module Ci scope :unstarted, -> { where(runner_id: nil) } + scope :with_any_artifacts, -> do + where('EXISTS (?)', + Ci::JobArtifact.select(1).where("#{Ci::Build.quoted_table_name}.id = #{Ci::JobArtifact.quoted_table_name}.job_id") + ) + end + scope :with_downloadable_artifacts, -> do where('EXISTS (?)', Ci::JobArtifact.select(1) diff --git a/app/models/issue.rb b/app/models/issue.rb index 6e0d228ab8c..bea86168c8d 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -181,7 +181,7 @@ class Issue < ApplicationRecord scope :confidential_only, -> { where(confidential: true) } scope :without_hidden, -> { - where.not(author_id: Users::BannedUser.select(:user_id)) + where('NOT EXISTS (?)', Users::BannedUser.select(1).where('issues.author_id = banned_users.user_id')) } scope :counts_by_state, -> { reorder(nil).group(:state_id).count } |