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
1be5430d
Commit
1be5430d
authored
Feb 25, 2021
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remove_for_id' into 'master'
Remove for_ids scope See merge request gitlab-org/gitlab!54897
parents
b0edafe7
bba41afc
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
11 additions
and
31 deletions
+11
-31
app/controllers/dashboard/todos_controller.rb
app/controllers/dashboard/todos_controller.rb
+1
-1
app/controllers/projects/pipelines/tests_controller.rb
app/controllers/projects/pipelines/tests_controller.rb
+1
-1
app/graphql/mutations/todos/restore_many.rb
app/graphql/mutations/todos/restore_many.rb
+1
-1
app/models/commit_status.rb
app/models/commit_status.rb
+0
-1
app/models/todo.rb
app/models/todo.rb
+0
-1
app/services/ci/pipeline_processing/atomic_processing_service.rb
...vices/ci/pipeline_processing/atomic_processing_service.rb
+1
-1
ee/app/finders/ee/issues_finder/params.rb
ee/app/finders/ee/issues_finder/params.rb
+1
-1
ee/app/graphql/resolvers/board_groupings/epics_resolver.rb
ee/app/graphql/resolvers/board_groupings/epics_resolver.rb
+1
-1
ee/app/models/ee/epic.rb
ee/app/models/ee/epic.rb
+2
-3
ee/app/services/ee/issuable/bulk_update_service.rb
ee/app/services/ee/issuable/bulk_update_service.rb
+1
-1
ee/app/services/epics/update_dates_service.rb
ee/app/services/epics/update_dates_service.rb
+1
-1
ee/app/workers/epics/update_epics_dates_worker.rb
ee/app/workers/epics/update_epics_dates_worker.rb
+1
-1
spec/models/todo_spec.rb
spec/models/todo_spec.rb
+0
-17
No files found.
app/controllers/dashboard/todos_controller.rb
View file @
1be5430d
...
...
@@ -52,7 +52,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
def
bulk_restore
TodoService
.
new
.
restore_todos
(
current_user
.
todos
.
for_ids
(
params
[
:ids
]),
current_user
)
TodoService
.
new
.
restore_todos
(
current_user
.
todos
.
id_in
(
params
[
:ids
]),
current_user
)
render
json:
todos_counts
end
...
...
app/controllers/projects/pipelines/tests_controller.rb
View file @
1be5430d
...
...
@@ -32,7 +32,7 @@ module Projects
# rubocop: disable CodeReuse/ActiveRecord
def
builds
@builds
||=
pipeline
.
latest_builds
.
for_ids
(
build_ids
).
presence
||
render_404
@builds
||=
pipeline
.
latest_builds
.
id_in
(
build_ids
).
presence
||
render_404
end
def
build_ids
...
...
app/graphql/mutations/todos/restore_many.rb
View file @
1be5430d
...
...
@@ -60,7 +60,7 @@ module Mutations
def
authorized_find_all_pending_by_current_user
(
ids
)
return
Todo
.
none
if
ids
.
blank?
||
current_user
.
nil?
Todo
.
for_ids
(
ids
).
for_user
(
current_user
).
done
Todo
.
id_in
(
ids
).
for_user
(
current_user
).
done
end
def
restore
(
todos
)
...
...
app/models/commit_status.rb
View file @
1be5430d
...
...
@@ -52,7 +52,6 @@ class CommitStatus < ApplicationRecord
scope
:before_stage
,
->
(
index
)
{
where
(
'stage_idx < ?'
,
index
)
}
scope
:for_stage
,
->
(
index
)
{
where
(
stage_idx:
index
)
}
scope
:after_stage
,
->
(
index
)
{
where
(
'stage_idx > ?'
,
index
)
}
scope
:for_ids
,
->
(
ids
)
{
where
(
id:
ids
)
}
scope
:for_ref
,
->
(
ref
)
{
where
(
ref:
ref
)
}
scope
:by_name
,
->
(
name
)
{
where
(
name:
name
)
}
scope
:in_pipelines
,
->
(
pipelines
)
{
where
(
pipeline:
pipelines
)
}
...
...
app/models/todo.rb
View file @
1be5430d
...
...
@@ -55,7 +55,6 @@ class Todo < ApplicationRecord
validates
:project
,
presence:
true
,
unless: :group_id
validates
:group
,
presence:
true
,
unless: :project_id
scope
:for_ids
,
->
(
ids
)
{
where
(
id:
ids
)
}
scope
:pending
,
->
{
with_state
(
:pending
)
}
scope
:done
,
->
{
with_state
(
:done
)
}
scope
:for_action
,
->
(
action
)
{
where
(
action:
action
)
}
...
...
app/services/ci/pipeline_processing/atomic_processing_service.rb
View file @
1be5430d
...
...
@@ -53,7 +53,7 @@ module Ci
end
def
update_processables!
(
ids
)
created_processables
=
pipeline
.
processables
.
for_ids
(
ids
)
created_processables
=
pipeline
.
processables
.
id_in
(
ids
)
.
with_project_preload
.
created
.
latest
...
...
ee/app/finders/ee/issues_finder/params.rb
View file @
1be5430d
...
...
@@ -45,7 +45,7 @@ module EE
def
epics
if
params
[
:include_subepics
]
::
Gitlab
::
ObjectHierarchy
.
new
(
::
Epic
.
for_ids
(
params
[
:epic_id
])).
base_and_descendants
.
select
(
:id
)
::
Gitlab
::
ObjectHierarchy
.
new
(
::
Epic
.
id_in
(
params
[
:epic_id
])).
base_and_descendants
.
select
(
:id
)
else
params
[
:epic_id
]
end
...
...
ee/app/graphql/resolvers/board_groupings/epics_resolver.rb
View file @
1be5430d
...
...
@@ -19,7 +19,7 @@ module Resolvers
context
.
scoped_set!
(
:board
,
board
)
Epic
.
for_ids
(
board_epic_ids
(
args
[
:issue_filters
]))
Epic
.
id_in
(
board_epic_ids
(
args
[
:issue_filters
]))
end
private
...
...
ee/app/models/ee/epic.rb
View file @
1be5430d
...
...
@@ -67,7 +67,6 @@ module EE
alias_attribute
:parent_ids
,
:parent_id
alias_method
:issuing_parent
,
:group
scope
:for_ids
,
->
(
ids
)
{
where
(
id:
ids
)
}
scope
:in_parents
,
->
(
parent_ids
)
{
where
(
parent_id:
parent_ids
)
}
scope
:inc_group
,
->
{
includes
(
:group
)
}
scope
:in_selected_groups
,
->
(
groups
)
{
where
(
group_id:
groups
)
}
...
...
@@ -274,11 +273,11 @@ module EE
end
def
ids_for_base_and_decendants
(
epic_ids
)
::
Gitlab
::
ObjectHierarchy
.
new
(
self
.
for_ids
(
epic_ids
)).
base_and_descendants
.
pluck
(
:id
)
::
Gitlab
::
ObjectHierarchy
.
new
(
self
.
id_in
(
epic_ids
)).
base_and_descendants
.
pluck
(
:id
)
end
def
issue_metadata_for_epics
(
epic_ids
:,
limit
:)
records
=
self
.
for_ids
(
epic_ids
)
records
=
self
.
id_in
(
epic_ids
)
.
left_joins
(
epic_issues: :issue
)
.
group
(
"epics.id"
,
"epics.iid"
,
"epics.parent_id"
,
"epics.state_id"
,
"issues.state_id"
)
.
select
(
"epics.id, epics.iid, epics.parent_id, epics.state_id AS epic_state_id, issues.state_id AS issues_state_id, COUNT(issues) AS issues_count, SUM(COALESCE(issues.weight, 0)) AS issues_weight_sum"
)
...
...
ee/app/services/ee/issuable/bulk_update_service.rb
View file @
1be5430d
...
...
@@ -9,7 +9,7 @@ module EE
override
:find_issuables
def
find_issuables
(
parent
,
model_class
,
ids
)
return
model_class
.
for_ids
(
ids
).
in_selected_groups
(
parent
.
self_and_descendants
)
if
model_class
==
::
Epic
return
model_class
.
id_in
(
ids
).
in_selected_groups
(
parent
.
self_and_descendants
)
if
model_class
==
::
Epic
super
end
...
...
ee/app/services/epics/update_dates_service.rb
View file @
1be5430d
...
...
@@ -11,7 +11,7 @@ module Epics
def
initialize
(
epics
)
@epics
=
epics
@epics
=
Epic
.
for_ids
(
@epics
)
unless
@epics
.
is_a?
(
ActiveRecord
::
Relation
)
@epics
=
Epic
.
id_in
(
@epics
)
unless
@epics
.
is_a?
(
ActiveRecord
::
Relation
)
end
def
execute
...
...
ee/app/workers/epics/update_epics_dates_worker.rb
View file @
1be5430d
...
...
@@ -10,7 +10,7 @@ module Epics
def
perform
(
epic_ids
)
return
if
epic_ids
.
blank?
Epics
::
UpdateDatesService
.
new
(
Epic
.
for_ids
(
epic_ids
)).
execute
Epics
::
UpdateDatesService
.
new
(
Epic
.
id_in
(
epic_ids
)).
execute
end
end
end
spec/models/todo_spec.rb
View file @
1be5430d
...
...
@@ -363,23 +363,6 @@ RSpec.describe Todo do
end
end
describe
'.for_ids'
do
it
'returns the expected todos'
do
todo1
=
create
(
:todo
)
todo2
=
create
(
:todo
)
todo3
=
create
(
:todo
)
create
(
:todo
)
expect
(
described_class
.
for_ids
([
todo2
.
id
,
todo1
.
id
,
todo3
.
id
])).
to
contain_exactly
(
todo1
,
todo2
,
todo3
)
end
it
'returns an empty collection when no ids are given'
do
create
(
:todo
)
expect
(
described_class
.
for_ids
([])).
to
be_empty
end
end
describe
'.for_user'
do
it
'returns the expected todos'
do
user1
=
create
(
:user
)
...
...
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