Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d509f0e1
Commit
d509f0e1
authored
Mar 31, 2021
by
Shubham Kumar
Committed by
Heinrich Lee Yu
Apr 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolves rubocop offense Rails/WhereEquals
Fixes auto correct rubocop offenses
parent
e77edc54
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
56 additions
and
56 deletions
+56
-56
.rubocop_todo.yml
.rubocop_todo.yml
+0
-5
app/finders/ci/pipelines_finder.rb
app/finders/ci/pipelines_finder.rb
+1
-1
app/models/concerns/milestoneable.rb
app/models/concerns/milestoneable.rb
+1
-1
app/models/deployment_merge_request.rb
app/models/deployment_merge_request.rb
+2
-2
app/models/group.rb
app/models/group.rb
+3
-3
app/models/issue_assignee.rb
app/models/issue_assignee.rb
+1
-1
app/models/members/project_member.rb
app/models/members/project_member.rb
+1
-1
app/models/merge_request_assignee.rb
app/models/merge_request_assignee.rb
+1
-1
app/models/milestone.rb
app/models/milestone.rb
+1
-1
app/models/namespace.rb
app/models/namespace.rb
+1
-1
app/models/network/graph.rb
app/models/network/graph.rb
+1
-1
app/models/operations/feature_flag.rb
app/models/operations/feature_flag.rb
+1
-1
app/models/snippet.rb
app/models/snippet.rb
+1
-1
app/services/boards/base_items_list_service.rb
app/services/boards/base_items_list_service.rb
+1
-1
app/services/todos/destroy/confidential_issue_service.rb
app/services/todos/destroy/confidential_issue_service.rb
+1
-1
changelogs/unreleased/pl-rubocop-todo-where-equals.yml
changelogs/unreleased/pl-rubocop-todo-where-equals.yml
+5
-0
db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb
...20200511083541_cleanup_projects_with_missing_namespace.rb
+6
-6
db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb
..._routes_for_lost_and_found_group_and_orphaned_projects.rb
+5
-5
db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb
...igrate/20200703064117_generate_missing_routes_for_bots.rb
+1
-1
db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb
...09161624_cleanup_group_import_states_with_null_user_id.rb
+1
-1
db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb
...grate/20201026185514_ensure_u2f_registrations_migrated.rb
+1
-1
db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb
...42_cleanup_gitlab_subscriptions_with_null_namespace_id.rb
+1
-1
db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb
...e/20210303165302_cleanup_cluster_tokens_with_null_name.rb
+1
-1
db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
...0210311120155_backfill_events_id_for_bigint_conversion.rb
+1
-1
db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
...fill_push_event_payload_event_id_for_bigint_conversion.rb
+1
-1
db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb
...15101228_backfill_ci_build_needs_for_bigint_conversion.rb
+1
-1
db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb
...20210420121149_backfill_conversion_of_ci_job_artifacts.rb
+1
-1
db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb
..._sources_pipelines_source_job_id_for_bigint_conversion.rb
+1
-1
ee/app/models/ee/packages/package_file.rb
ee/app/models/ee/packages/package_file.rb
+1
-1
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+1
-1
ee/app/services/ee/boards/issues/list_service.rb
ee/app/services/ee/boards/issues/list_service.rb
+1
-1
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+1
-1
ee/lib/tasks/gitlab/elastic.rake
ee/lib/tasks/gitlab/elastic.rake
+1
-1
lib/banzai/reference_parser/project_parser.rb
lib/banzai/reference_parser/project_parser.rb
+1
-1
lib/gitlab/database/background_migration_job.rb
lib/gitlab/database/background_migration_job.rb
+1
-1
spec/migrations/cleanup_projects_with_missing_namespace_spec.rb
...igrations/cleanup_projects_with_missing_namespace_spec.rb
+6
-6
No files found.
.rubocop_todo.yml
View file @
d509f0e1
...
...
@@ -626,11 +626,6 @@ Rails/SkipsModelValidations:
Rails/SquishedSQLHeredocs
:
Enabled
:
false
# Offense count: 44
# Cop supports --auto-correct.
Rails/WhereEquals
:
Enabled
:
false
# Offense count: 44
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
...
...
app/finders/ci/pipelines_finder.rb
View file @
d509f0e1
...
...
@@ -133,7 +133,7 @@ module Ci
when
true
items
.
where
.
not
(
yaml_errors:
nil
)
when
false
items
.
where
(
"yaml_errors IS NULL"
)
items
.
where
(
yaml_errors:
nil
)
else
items
end
...
...
app/models/concerns/milestoneable.rb
View file @
d509f0e1
...
...
@@ -28,7 +28,7 @@ module Milestoneable
scope
:without_release
,
->
do
joins
(
"LEFT OUTER JOIN milestone_releases ON
#{
table_name
}
.milestone_id = milestone_releases.milestone_id"
)
.
where
(
'milestone_releases.release_id IS NULL'
)
.
where
(
milestone_releases:
{
release_id:
nil
}
)
end
scope
:joins_milestone_releases
,
->
do
...
...
app/models/deployment_merge_request.rb
View file @
d509f0e1
...
...
@@ -12,7 +12,7 @@ class DeploymentMergeRequest < ApplicationRecord
end
def
self
.
by_deployment_id
(
id
)
where
(
'deployments.id = ?'
,
id
)
where
(
deployments:
{
id:
id
}
)
end
def
self
.
deployed_to
(
name
)
...
...
@@ -20,7 +20,7 @@ class DeploymentMergeRequest < ApplicationRecord
# (project_id, name), instead of using the index on
# (name varchar_pattern_ops). This results in better performance on
# GitLab.com.
where
(
'environments.name = ?'
,
name
)
where
(
environments:
{
name:
name
}
)
.
where
(
'environments.project_id = merge_requests.target_project_id'
)
end
...
...
app/models/group.rb
View file @
d509f0e1
...
...
@@ -109,13 +109,13 @@ class Group < Namespace
scope
:for_authorized_group_members
,
->
(
user_ids
)
do
joins
(
:group_members
)
.
where
(
"members.user_id IN (?)"
,
user_ids
)
.
where
(
members:
{
user_id:
user_ids
}
)
.
where
(
"access_level >= ?"
,
Gitlab
::
Access
::
GUEST
)
end
scope
:for_authorized_project_members
,
->
(
user_ids
)
do
joins
(
projects: :project_authorizations
)
.
where
(
"project_authorizations.user_id IN (?)"
,
user_ids
)
.
where
(
project_authorizations:
{
user_id:
user_ids
}
)
end
class
<<
self
...
...
@@ -153,7 +153,7 @@ class Group < Namespace
def
select_for_project_authorization
if
current_scope
.
joins_values
.
include?
(
:shared_projects
)
joins
(
'INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id'
)
.
where
(
'project_namespace.share_with_group_lock = ?'
,
false
)
.
where
(
project_namespace:
{
share_with_group_lock:
false
}
)
.
select
(
"projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level"
)
else
super
...
...
app/models/issue_assignee.rb
View file @
d509f0e1
...
...
@@ -8,7 +8,7 @@ class IssueAssignee < ApplicationRecord
validates
:assignee
,
uniqueness:
{
scope: :issue_id
}
scope
:in_projects
,
->
(
project_ids
)
{
joins
(
:issue
).
where
(
"issues.project_id in (?)"
,
project_ids
)
}
scope
:in_projects
,
->
(
project_ids
)
{
joins
(
:issue
).
where
(
issues:
{
project_id:
project_ids
}
)
}
scope
:on_issues
,
->
(
issue_ids
)
{
where
(
issue_id:
issue_ids
)
}
scope
:for_assignee
,
->
(
user
)
{
where
(
assignee:
user
)
}
end
...
...
app/models/members/project_member.rb
View file @
d509f0e1
...
...
@@ -16,7 +16,7 @@ class ProjectMember < Member
scope
:in_project
,
->
(
project
)
{
where
(
source_id:
project
.
id
)
}
scope
:in_namespaces
,
->
(
groups
)
do
joins
(
'INNER JOIN projects ON projects.id = members.source_id'
)
.
where
(
'projects.namespace_id in (?)'
,
groups
.
select
(
:id
)
)
.
where
(
projects:
{
namespace_id:
groups
.
select
(
:id
)
}
)
end
scope
:without_project_bots
,
->
do
...
...
app/models/merge_request_assignee.rb
View file @
d509f0e1
...
...
@@ -6,5 +6,5 @@ class MergeRequestAssignee < ApplicationRecord
validates
:assignee
,
uniqueness:
{
scope: :merge_request_id
}
scope
:in_projects
,
->
(
project_ids
)
{
joins
(
:merge_request
).
where
(
"merge_requests.target_project_id in (?)"
,
project_ids
)
}
scope
:in_projects
,
->
(
project_ids
)
{
joins
(
:merge_request
).
where
(
merge_requests:
{
target_project_id:
project_ids
}
)
}
end
app/models/milestone.rb
View file @
d509f0e1
...
...
@@ -94,7 +94,7 @@ class Milestone < ApplicationRecord
end
def
participants
User
.
joins
(
assigned_issues: :milestone
).
where
(
"milestones.id = ?"
,
id
).
distinct
User
.
joins
(
assigned_issues: :milestone
).
where
(
milestones:
{
id:
id
}
).
distinct
end
def
self
.
sort_by_attribute
(
method
)
...
...
app/models/namespace.rb
View file @
d509f0e1
...
...
@@ -89,7 +89,7 @@ class Namespace < ApplicationRecord
before_destroy
(
prepend:
true
)
{
prepare_for_destroy
}
after_destroy
:rm_dir
scope
:for_user
,
->
{
where
(
'type IS NULL'
)
}
scope
:for_user
,
->
{
where
(
type:
nil
)
}
scope
:sort_by_type
,
->
{
order
(
Gitlab
::
Database
.
nulls_first_order
(
:type
))
}
scope
:include_route
,
->
{
includes
(
:route
)
}
scope
:by_parent
,
->
(
parent
)
{
where
(
parent_id:
parent
)
}
...
...
app/models/network/graph.rb
View file @
d509f0e1
...
...
@@ -27,7 +27,7 @@ module Network
@project
.
notes
.
where
(
'noteable_type = ?'
,
'Commit'
)
.
where
(
noteable_type:
'Commit'
)
.
group
(
'notes.commit_id'
)
.
select
(
'notes.commit_id, count(notes.id) as note_count'
)
.
each
do
|
item
|
...
...
app/models/operations/feature_flag.rb
View file @
d509f0e1
...
...
@@ -97,7 +97,7 @@ module Operations
issues
=
::
Issue
.
select
(
'issues.*, operations_feature_flags_issues.id AS link_id'
)
.
joins
(
:feature_flag_issues
)
.
where
(
'operations_feature_flags_issues.feature_flag_id = ?'
,
id
)
.
where
(
operations_feature_flags_issues:
{
feature_flag_id:
id
}
)
.
order
(
'operations_feature_flags_issues.id ASC'
)
.
includes
(
preload
)
...
...
app/models/snippet.rb
View file @
d509f0e1
...
...
@@ -118,7 +118,7 @@ class Snippet < ApplicationRecord
def
self
.
only_include_projects_visible_to
(
current_user
=
nil
)
levels
=
Gitlab
::
VisibilityLevel
.
levels_for_user
(
current_user
)
joins
(
:project
).
where
(
'projects.visibility_level IN (?)'
,
levels
)
joins
(
:project
).
where
(
projects:
{
visibility_level:
levels
}
)
end
def
self
.
only_include_projects_with_snippets_enabled
(
include_private:
false
)
...
...
app/services/boards/base_items_list_service.rb
View file @
d509f0e1
...
...
@@ -129,7 +129,7 @@ module Boards
# rubocop: disable CodeReuse/ActiveRecord
def
label_links
(
label_ids
)
LabelLink
.
where
(
'label_links.target_type = ?'
,
item_model
)
.
where
(
label_links:
{
target_type:
item_model
}
)
.
where
(
item_model
.
arel_table
[
:id
].
eq
(
LabelLink
.
arel_table
[
:target_id
]).
to_sql
)
.
where
(
label_id:
label_ids
)
end
...
...
app/services/todos/destroy/confidential_issue_service.rb
View file @
d509f0e1
...
...
@@ -37,7 +37,7 @@ module Todos
def
todos
Todo
.
joins_issue_and_assignees
.
where
(
target:
issues
)
.
where
(
'issues.confidential = ?'
,
true
)
.
where
(
issues:
{
confidential:
true
}
)
.
where
(
'todos.user_id != issues.author_id'
)
.
where
(
'todos.user_id != issue_assignees.user_id'
)
end
...
...
changelogs/unreleased/pl-rubocop-todo-where-equals.yml
0 → 100644
View file @
d509f0e1
---
title
:
Resolves rubocop offenses Rails/WhereEquals
merge_request
:
58067
author
:
Shubham Kumar (@imskr)
type
:
fixed
db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb
View file @
d509f0e1
...
...
@@ -82,12 +82,12 @@ class CleanupProjectsWithMissingNamespace < ActiveRecord::Migration[6.0]
# There should only be one Group for User Ghost starting with LOST_AND_FOUND_GROUP
Group
.
joins
(
'INNER JOIN members ON namespaces.id = members.source_id'
)
.
where
(
'namespaces.type = ?'
,
'Group'
)
.
where
(
'members.type = ?'
,
'GroupMember'
)
.
where
(
'members.source_type = ?'
,
'Namespace'
)
.
where
(
'members.user_id = ?'
,
self
.
id
)
.
where
(
'members.requested_at IS NULL'
)
.
where
(
'members.access_level = ?'
,
ACCESS_LEVEL_OWNER
)
.
where
(
namespaces:
{
type:
'Group'
}
)
.
where
(
members:
{
type:
'GroupMember'
}
)
.
where
(
members:
{
source_type:
'Namespace'
}
)
.
where
(
members:
{
user_id:
self
.
id
}
)
.
where
(
members:
{
requested_at:
nil
}
)
.
where
(
members:
{
access_level:
ACCESS_LEVEL_OWNER
}
)
.
find_by
(
Group
.
arel_table
[
:name
].
matches
(
"
#{
LOST_AND_FOUND_GROUP
}
%"
))
end
...
...
db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb
View file @
d509f0e1
...
...
@@ -25,11 +25,11 @@ class UpdateRoutesForLostAndFoundGroupAndOrphanedProjects < ActiveRecord::Migrat
# There should only be one Group owned by the Ghost user starting with 'lost-and-found'
Group
.
joins
(
'INNER JOIN members ON namespaces.id = members.source_id'
)
.
where
(
'namespaces.type = ?'
,
'Group'
)
.
where
(
'members.type = ?'
,
'GroupMember'
)
.
where
(
'members.source_type = ?'
,
'Namespace'
)
.
where
(
'members.user_id = ?'
,
self
.
id
)
.
where
(
'members.access_level = ?'
,
ACCESS_LEVEL_OWNER
)
.
where
(
namespaces:
{
type:
'Group'
}
)
.
where
(
members:
{
type:
'GroupMember'
}
)
.
where
(
members:
{
source_type:
'Namespace'
}
)
.
where
(
members:
{
user_id:
self
.
id
}
)
.
where
(
members:
{
access_level:
ACCESS_LEVEL_OWNER
}
)
.
find_by
(
Group
.
arel_table
[
:name
].
matches
(
"
#{
LOST_AND_FOUND_GROUP
}
%"
))
end
...
...
db/post_migrate/20200703064117_generate_missing_routes_for_bots.rb
View file @
d509f0e1
...
...
@@ -36,7 +36,7 @@ class GenerateMissingRoutesForBots < ActiveRecord::Migration[6.0]
belongs_to
:owner
,
class_name:
'GenerateMissingRoutesForBots::User'
scope
:for_user
,
->
{
where
(
'type IS NULL'
)
}
scope
:for_user
,
->
{
where
(
type:
nil
)
}
scope
:for_bots
,
->
{
for_user
.
joins
(
:owner
).
merge
(
GenerateMissingRoutesForBots
::
User
.
bots
)
}
scope
:without_routes
,
->
do
...
...
db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb
View file @
d509f0e1
...
...
@@ -71,7 +71,7 @@ class CleanupGroupImportStatesWithNullUserId < ActiveRecord::Migration[6.0]
end
end
GroupImportState
.
where
(
'user_id IS NULL'
).
delete_all
GroupImportState
.
where
(
user_id:
nil
).
delete_all
end
def
down
...
...
db/post_migrate/20201026185514_ensure_u2f_registrations_migrated.rb
View file @
d509f0e1
...
...
@@ -21,7 +21,7 @@ class EnsureU2fRegistrationsMigrated < ActiveRecord::Migration[6.0]
# Do a manual update in case we lost BG jobs. The expected record count should be 0 or very low.
U2fRegistration
.
joins
(
"LEFT JOIN webauthn_registrations ON webauthn_registrations.u2f_registration_id = u2f_registrations.id"
)
.
where
(
"webauthn_registrations.u2f_registration_id IS NULL"
)
.
where
(
webauthn_registrations:
{
u2f_registration_id:
nil
}
)
.
each_batch
(
of:
BATCH_SIZE
)
do
|
batch
,
index
|
batch
.
each
do
|
record
|
Gitlab
::
BackgroundMigration
::
MigrateU2fWebauthn
.
new
.
perform
(
record
.
id
,
record
.
id
)
...
...
db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb
View file @
d509f0e1
...
...
@@ -15,7 +15,7 @@ class CleanupGitlabSubscriptionsWithNullNamespaceId < ActiveRecord::Migration[6.
# This will be fast on GitLab.com, because:
# - gitlab_subscriptions.count=5021850
# - namespace_id is indexed, so the query is pretty fast. Try on database-lab, this uses 5.931 ms
GitlabSubscription
.
where
(
'namespace_id IS NULL'
).
delete_all
GitlabSubscription
.
where
(
namespace_id:
nil
).
delete_all
end
def
down
...
...
db/post_migrate/20210303165302_cleanup_cluster_tokens_with_null_name.rb
View file @
d509f0e1
...
...
@@ -15,7 +15,7 @@ class CleanupClusterTokensWithNullName < ActiveRecord::Migration[6.0]
def
up
AgentToken
.
each_batch
(
of:
BATCH_SIZE
)
do
|
relation
|
relation
.
where
(
'name IS NULL'
).
update_all
(
"name = 'agent-token-' || id"
)
relation
.
where
(
name:
nil
).
update_all
(
"name = 'agent-token-' || id"
)
end
end
...
...
db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
View file @
d509f0e1
...
...
@@ -17,7 +17,7 @@ class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0]
Gitlab
::
Database
::
BackgroundMigration
::
BatchedMigration
.
where
(
job_class_name:
'CopyColumnUsingBackgroundMigrationJob'
)
.
where
(
table_name:
'events'
,
column_name:
'id'
)
.
where
(
'job_arguments = ?'
,
%w[id id_convert_to_bigint]
.
to_json
)
.
where
(
job_arguments:
%w[id id_convert_to_bigint]
.
to_json
)
.
delete_all
end
...
...
db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
View file @
d509f0e1
...
...
@@ -18,7 +18,7 @@ class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migrati
Gitlab
::
Database
::
BackgroundMigration
::
BatchedMigration
.
where
(
job_class_name:
'CopyColumnUsingBackgroundMigrationJob'
)
.
where
(
table_name:
'push_event_payloads'
,
column_name:
'event_id'
)
.
where
(
'job_arguments = ?'
,
%w[event_id event_id_convert_to_bigint]
.
to_json
)
.
where
(
job_arguments:
%w[event_id event_id_convert_to_bigint]
.
to_json
)
.
delete_all
end
...
...
db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb
View file @
d509f0e1
...
...
@@ -18,7 +18,7 @@ class BackfillCiBuildNeedsForBigintConversion < ActiveRecord::Migration[6.0]
Gitlab
::
Database
::
BackgroundMigration
::
BatchedMigration
.
where
(
job_class_name:
'CopyColumnUsingBackgroundMigrationJob'
)
.
where
(
table_name:
'ci_build_needs'
,
column_name:
'build_id'
)
.
where
(
'job_arguments = ?'
,
%w[build_id build_id_convert_to_bigint]
.
to_json
)
.
where
(
job_arguments:
%w[build_id build_id_convert_to_bigint]
.
to_json
)
.
delete_all
end
...
...
db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb
View file @
d509f0e1
...
...
@@ -17,7 +17,7 @@ class BackfillConversionOfCiJobArtifacts < ActiveRecord::Migration[6.0]
Gitlab
::
Database
::
BackgroundMigration
::
BatchedMigration
.
where
(
job_class_name:
'CopyColumnUsingBackgroundMigrationJob'
)
.
where
(
table_name:
'ci_job_artifacts'
,
column_name:
'id'
)
.
where
(
'job_arguments = ?'
,
[
%w[id job_id]
,
%w[id_convert_to_bigint job_id_convert_to_bigint]
].
to_json
)
.
where
(
job_arguments:
[
%w[id job_id]
,
%w[id_convert_to_bigint job_id_convert_to_bigint]
].
to_json
)
.
delete_all
end
...
...
db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb
View file @
d509f0e1
...
...
@@ -16,7 +16,7 @@ class BackfillCiSourcesPipelinesSourceJobIdForBigintConversion < ActiveRecord::M
Gitlab
::
Database
::
BackgroundMigration
::
BatchedMigration
.
where
(
job_class_name:
'CopyColumnUsingBackgroundMigrationJob'
)
.
where
(
table_name:
'ci_sources_pipelines'
,
column_name:
'id'
)
.
where
(
'job_arguments = ?'
,
[
%w[source_job_id]
,
%w[source_job_id_convert_to_bigint]
].
to_json
)
.
where
(
job_arguments:
[
%w[source_job_id]
,
%w[source_job_id_convert_to_bigint]
].
to_json
)
.
delete_all
end
...
...
ee/app/models/ee/packages/package_file.rb
View file @
d509f0e1
...
...
@@ -35,7 +35,7 @@ module EE
return
self
.
all
unless
::
Gitlab
::
Geo
.
current_node
.
selective_sync?
self
.
joins
(
:package
)
.
where
(
'packages_packages.project_id IN (?)'
,
::
Gitlab
::
Geo
.
current_node
.
projects
.
select
(
:id
)
)
.
where
(
packages_packages:
{
project_id:
::
Gitlab
::
Geo
.
current_node
.
projects
.
select
(
:id
)
}
)
end
end
...
...
ee/app/models/ee/project.rb
View file @
d509f0e1
...
...
@@ -286,7 +286,7 @@ module EE
def
with_slack_application_disabled
joins
(
'LEFT JOIN services ON services.project_id = projects.id AND services.type = \'GitlabSlackApplicationService\' AND services.active IS true'
)
.
where
(
'services.id IS NULL'
)
.
where
(
services:
{
id:
nil
}
)
end
override
:with_web_entity_associations
...
...
ee/app/services/ee/boards/issues/list_service.rb
View file @
d509f0e1
...
...
@@ -32,7 +32,7 @@ module EE
# rubocop: disable CodeReuse/ActiveRecord
def
label_links
(
label_ids
)
if
has_valid_milestone?
super
.
where
(
"issues.milestone_id = ?"
,
board
.
milestone_id
)
super
.
where
(
issues:
{
milestone_id:
board
.
milestone_id
}
)
else
super
end
...
...
ee/lib/ee/gitlab/usage_data.rb
View file @
d509f0e1
...
...
@@ -479,7 +479,7 @@ module EE
::
Security
::
Scan
.
scan_types
.
each
do
|
name
,
scan_type
|
relation
=
::
Ci
::
Build
.
joins
(
:security_scans
)
.
where
(
status:
'success'
,
retried:
[
nil
,
false
])
.
where
(
'security_scans.scan_type = ?'
,
scan_type
)
.
where
(
security_scans:
{
scan_type:
scan_type
}
)
.
where
(
time_period
)
pipelines_with_secure_jobs
[
"
#{
name
}
_pipeline"
.
to_sym
]
=
distinct_count
(
relation
,
:commit_id
,
start:
start
,
finish:
finish
,
batch:
false
)
end
...
...
ee/lib/tasks/gitlab/elastic.rake
View file @
d509f0e1
...
...
@@ -182,7 +182,7 @@ namespace :gitlab do
relation
=
Project
.
all
unless
ENV
[
'UPDATE_INDEX'
]
relation
=
relation
.
includes
(
:index_status
).
where
(
'index_statuses.id IS NULL'
).
references
(
:index_statuses
)
relation
=
relation
.
includes
(
:index_status
).
where
(
index_statuses:
{
id:
nil
}
).
references
(
:index_statuses
)
end
if
::
Gitlab
::
CurrentSettings
.
elasticsearch_limit_indexing?
...
...
lib/banzai/reference_parser/project_parser.rb
View file @
d509f0e1
...
...
@@ -19,7 +19,7 @@ module Banzai
def
readable_project_ids_for
(
user
)
@project_ids_by_user
||=
{}
@project_ids_by_user
[
user
]
||=
Project
.
public_or_visible_to_user
(
user
).
where
(
"projects.id IN (?)"
,
@projects_for_nodes
.
values
.
map
(
&
:id
)
).
pluck
(
:id
)
Project
.
public_or_visible_to_user
(
user
).
where
(
projects:
{
id:
@projects_for_nodes
.
values
.
map
(
&
:id
)
}
).
pluck
(
:id
)
end
def
can_read_reference?
(
user
,
ref_project
,
node
)
...
...
lib/gitlab/database/background_migration_job.rb
View file @
d509f0e1
...
...
@@ -9,7 +9,7 @@ module Gitlab
scope
:for_migration_class
,
->
(
class_name
)
{
where
(
class_name:
normalize_class_name
(
class_name
))
}
scope
:for_migration_execution
,
->
(
class_name
,
arguments
)
do
for_migration_class
(
class_name
).
where
(
'arguments = ?'
,
arguments
.
to_json
)
for_migration_class
(
class_name
).
where
(
'arguments = ?'
,
arguments
.
to_json
)
# rubocop:disable Rails/WhereEquals
end
scope
:for_partitioning_migration
,
->
(
class_name
,
table_name
)
do
...
...
spec/migrations/cleanup_projects_with_missing_namespace_spec.rb
View file @
d509f0e1
...
...
@@ -95,12 +95,12 @@ RSpec.describe CleanupProjectsWithMissingNamespace, :migration, schema: SchemaVe
expect
(
described_class
::
Group
.
joins
(
'INNER JOIN members ON namespaces.id = members.source_id'
)
.
where
(
'namespaces.type = ?'
,
'Group'
)
.
where
(
'members.type = ?'
,
'GroupMember'
)
.
where
(
'members.source_type = ?'
,
'Namespace'
)
.
where
(
'members.user_id = ?'
,
ghost_user
.
id
)
.
where
(
'members.requested_at IS NULL'
)
.
where
(
'members.access_level = ?'
,
described_class
::
ACCESS_LEVEL_OWNER
)
.
where
(
namespaces:
{
type:
'Group'
}
)
.
where
(
members:
{
type:
'GroupMember'
}
)
.
where
(
members:
{
source_type:
'Namespace'
}
)
.
where
(
members:
{
user_id:
ghost_user
.
id
}
)
.
where
(
members:
{
requested_at:
nil
}
)
.
where
(
members:
{
access_level:
described_class
::
ACCESS_LEVEL_OWNER
}
)
.
where
(
described_class
::
Group
.
arel_table
[
:name
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment