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
0ad12281
Commit
0ad12281
authored
Sep 03, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary code
parent
b41a151e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
79 deletions
+0
-79
app/services/issues/reorder_service.rb
app/services/issues/reorder_service.rb
+0
-17
spec/services/issues/reorder_service_spec.rb
spec/services/issues/reorder_service_spec.rb
+0
-62
No files found.
app/services/issues/reorder_service.rb
View file @
0ad12281
...
...
@@ -7,7 +7,6 @@ module Issues
return
false
if
group
&&
!
can?
(
current_user
,
:read_group
,
group
)
attrs
=
issue_params
(
group
)
return
move_to_end
(
issue
)
if
params
[
:placement
]
==
:end
return
false
if
attrs
.
empty?
update
(
issue
,
attrs
)
...
...
@@ -15,22 +14,6 @@ module Issues
private
def
move_to_end
(
issue
)
issue
.
move_to_end
return
false
unless
issue
.
save
rebalance_if_needed
(
issue
)
true
rescue
RelativePositioning
::
NoSpaceLeft
gates
=
[
issue
.
project
,
issue
.
project
.
group
].
compact
if
gates
.
any?
{
|
gate
|
Feature
.
enabled?
(
:rebalance_issues
,
gate
)
}
IssueRebalancingWorker
.
perform_async
(
nil
,
issue
.
project_id
)
end
issue
.
update
(
relative_position:
RelativePositioning
::
MAX_POSITION
)
end
def
group
return
unless
params
[
:group_full_path
]
...
...
spec/services/issues/reorder_service_spec.rb
View file @
0ad12281
...
...
@@ -19,68 +19,6 @@ RSpec.describe Issues::ReorderService do
expect
(
service
(
params
).
execute
(
issue1
)).
to
be_falsey
end
it
'moves the issue to the end if placement == :end'
do
params
=
{
placement: :end
}
max_position
=
project
.
issues
.
maximum
(
:relative_position
)
expect
do
expect
(
service
(
params
).
execute
(
issue1
)).
to
be_truthy
end
.
to
change
(
issue1
,
:relative_position
).
to
(
be
>
max_position
)
end
it
'rebalances if needed'
do
params
=
{
placement: :end
}
issue3
.
update!
(
relative_position:
RelativePositioning
::
MAX_POSITION
)
expect
(
IssueRebalancingWorker
).
to
receive
(
:perform_async
).
with
(
nil
,
project
.
id
)
expect
(
service
(
params
).
execute
(
issue1
)).
to
be_truthy
expect
(
issue1
.
relative_position
).
to
eq
(
project
.
issues
.
maximum
(
:relative_position
))
end
it
'schedules rebalancing if there is no space left'
do
params
=
{
placement: :end
}
allow
(
issue1
).
to
receive
(
:move_to_end
)
{
raise
RelativePositioning
::
NoSpaceLeft
}
expect
(
IssueRebalancingWorker
).
to
receive
(
:perform_async
).
with
(
nil
,
project
.
id
)
expect
{
expect
(
service
(
params
).
execute
(
issue1
)).
to
be_truthy
}
.
to
change
(
issue1
,
:relative_position
).
to
(
RelativePositioning
::
MAX_POSITION
)
end
it
'does not schedule rebalancing if there is no space left but the feature flag is off'
do
params
=
{
placement: :end
}
allow
(
issue1
).
to
receive
(
:move_to_end
)
{
raise
RelativePositioning
::
NoSpaceLeft
}
stub_feature_flags
(
rebalance_issues:
false
)
expect
(
IssueRebalancingWorker
).
not_to
receive
(
:perform_async
)
expect
{
service
(
params
).
execute
(
issue1
)
}
.
to
change
(
issue1
,
:relative_position
).
to
(
RelativePositioning
::
MAX_POSITION
)
end
it
'does not rebalance if the rebalance_issues feature flag is disabled'
do
params
=
{
placement: :end
}
issue3
.
update!
(
relative_position:
RelativePositioning
::
MAX_POSITION
)
stub_feature_flags
(
rebalance_issues:
false
)
expect
(
IssueRebalancingWorker
).
not_to
receive
(
:perform_async
)
expect
(
service
(
params
).
execute
(
issue1
)).
to
be_truthy
expect
(
issue1
.
relative_position
).
to
eq
(
project
.
issues
.
maximum
(
:relative_position
))
end
it
'rebalances if the rebalance_issues feature flag is enabled for this current project'
do
params
=
{
placement: :end
}
issue3
.
update!
(
relative_position:
RelativePositioning
::
MAX_POSITION
)
stub_feature_flags
(
rebalance_issues:
project
)
expect
(
IssueRebalancingWorker
).
to
receive
(
:perform_async
).
with
(
nil
,
project
.
id
)
expect
(
service
(
params
).
execute
(
issue1
)).
to
be_truthy
expect
(
issue1
.
relative_position
).
to
eq
(
project
.
issues
.
maximum
(
:relative_position
))
end
it
'sorts issues'
do
params
=
{
move_after_id:
issue2
.
id
,
move_before_id:
issue3
.
id
}
...
...
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