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
47c12680
Commit
47c12680
authored
Jan 05, 2018
by
Jarka Kadlecová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs & static-analysis failures
parent
2f950788
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
22 additions
and
26 deletions
+22
-26
app/assets/javascripts/issuable/related_issues/services/related_issues_service.js
...ssuable/related_issues/services/related_issues_service.js
+1
-1
app/models/concerns/relative_positioning.rb
app/models/concerns/relative_positioning.rb
+6
-10
app/models/issue.rb
app/models/issue.rb
+2
-3
db/schema.rb
db/schema.rb
+1
-1
ee/app/models/concerns/ee/relative_positioning.rb
ee/app/models/concerns/ee/relative_positioning.rb
+1
-1
ee/app/models/epic_issue.rb
ee/app/models/epic_issue.rb
+2
-2
ee/lib/api/epic_issues.rb
ee/lib/api/epic_issues.rb
+1
-1
spec/ee/spec/controllers/groups/epic_issues_controller_spec.rb
...ee/spec/controllers/groups/epic_issues_controller_spec.rb
+3
-2
spec/ee/spec/features/epics/epic_issues_spec.rb
spec/ee/spec/features/epics/epic_issues_spec.rb
+2
-2
spec/factories/epic_issues.rb
spec/factories/epic_issues.rb
+1
-1
spec/migrations/schedule_populate_merge_request_metrics_with_events_data_spec.rb
...e_populate_merge_request_metrics_with_events_data_spec.rb
+2
-2
No files found.
app/assets/javascripts/issuable/related_issues/services/related_issues_service.js
View file @
47c12680
...
...
@@ -22,7 +22,7 @@ class RelatedIssuesService {
return
Vue
.
http
.
put
(
endpoint
,
{
epic
:
{
move_before_id
,
move_after_id
move_after_id
,
},
});
}
...
...
app/models/concerns/relative_positioning.rb
View file @
47c12680
...
...
@@ -10,16 +10,12 @@ module RelativePositioning
after_save
:save_positionable_neighbours
end
def
project_ids
[
project
.
id
]
end
def
min_relative_position
self
.
class
.
in_parent
(
parent_id
).
minimum
(
:relative_position
)
self
.
class
.
in_parent
s
(
parent_ids
).
minimum
(
:relative_position
)
end
def
max_relative_position
self
.
class
.
in_parent
(
parent_id
).
maximum
(
:relative_position
)
self
.
class
.
in_parent
s
(
parent_ids
).
maximum
(
:relative_position
)
end
def
prev_relative_position
...
...
@@ -27,7 +23,7 @@ module RelativePositioning
if
self
.
relative_position
prev_pos
=
self
.
class
.
in_parent
([
parent_id
]
)
.
in_parent
s
(
parent_ids
)
.
where
(
'relative_position < ?'
,
self
.
relative_position
)
.
maximum
(
:relative_position
)
end
...
...
@@ -40,7 +36,7 @@ module RelativePositioning
if
self
.
relative_position
next_pos
=
self
.
class
.
in_parent
([
parent_id
]
)
.
in_parent
s
(
parent_ids
)
.
where
(
'relative_position > ?'
,
self
.
relative_position
)
.
minimum
(
:relative_position
)
end
...
...
@@ -67,7 +63,7 @@ module RelativePositioning
pos_after
=
before
.
next_relative_position
if
before
.
shift_after?
issue_to_move
=
self
.
class
.
in_parent
([
parent_id
]
).
find_by!
(
relative_position:
pos_after
)
issue_to_move
=
self
.
class
.
in_parent
s
(
parent_ids
).
find_by!
(
relative_position:
pos_after
)
issue_to_move
.
move_after
@positionable_neighbours
=
[
issue_to_move
]
# rubocop:disable Gitlab/ModuleWithInstanceVariables
...
...
@@ -82,7 +78,7 @@ module RelativePositioning
pos_before
=
after
.
prev_relative_position
if
after
.
shift_before?
issue_to_move
=
self
.
class
.
in_parent
([
parent_id
]
).
find_by!
(
relative_position:
pos_before
)
issue_to_move
=
self
.
class
.
in_parent
s
(
parent_ids
).
find_by!
(
relative_position:
pos_before
)
issue_to_move
.
move_before
@positionable_neighbours
=
[
issue_to_move
]
# rubocop:disable Gitlab/ModuleWithInstanceVariables
...
...
app/models/issue.rb
View file @
47c12680
...
...
@@ -47,7 +47,7 @@ class Issue < ActiveRecord::Base
validates
:project
,
presence:
true
alias_attribute
:parent_id
,
:project_id
alias_attribute
:parent_id
s
,
:project_id
scope
:in_projects
,
->
(
project_ids
)
{
where
(
project_id:
project_ids
)
}
...
...
@@ -96,10 +96,9 @@ class Issue < ActiveRecord::Base
acts_as_paranoid
class
<<
self
alias_method
:in_parent
,
:in_projects
alias_method
:in_parent
s
,
:in_projects
end
def
self
.
reference_prefix
'#'
end
...
...
db/schema.rb
View file @
47c12680
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2017122
1154744
)
do
ActiveRecord
::
Schema
.
define
(
version:
2017122
0191323
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
ee/app/models/concerns/ee/relative_positioning.rb
View file @
47c12680
...
...
@@ -11,7 +11,7 @@ module EE
board_group
&&
board_group
.
boards
.
any?
end
def
p
rojec
t_ids
def
p
aren
t_ids
return
super
unless
has_group_boards?
board_group
.
projects
.
select
(
:id
)
...
...
ee/app/models/epic_issue.rb
View file @
47c12680
...
...
@@ -7,11 +7,11 @@ class EpicIssue < ActiveRecord::Base
belongs_to
:epic
belongs_to
:issue
alias_attribute
:parent_id
,
:epic_id
alias_attribute
:parent_id
s
,
:epic_id
scope
:in_epic
,
->
(
epic_id
)
{
where
(
epic_id:
epic_id
)
}
class
<<
self
alias_method
:in_parent
,
:in_epic
alias_method
:in_parent
s
,
:in_epic
end
end
ee/lib/api/epic_issues.rb
View file @
47c12680
...
...
@@ -41,7 +41,7 @@ module API
update_params
=
{
move_before_id:
params
[
:move_before_id
],
move_after_id:
params
[
:move_after_id
]
,
move_after_id:
params
[
:move_after_id
]
}
result
=
::
EpicIssues
::
UpdateService
.
new
(
link
,
current_user
,
update_params
).
execute
...
...
spec/ee/spec/controllers/groups/epic_issues_controller_spec.rb
View file @
47c12680
...
...
@@ -27,7 +27,7 @@ describe Groups::EpicIssuesController do
end
describe
'GET #index'
do
let!
(
:epic_issue
s
)
{
create
(
:epic_issue
,
epic:
epic
,
issue:
issue
)
}
let!
(
:epic_issue
)
{
create
(
:epic_issue
,
epic:
epic
,
issue:
issue
)
}
subject
{
get
:index
,
group_id:
group
,
epic_id:
epic
.
to_param
}
...
...
@@ -52,7 +52,8 @@ describe Groups::EpicIssuesController do
'state'
=>
issue
.
state
,
'reference'
=>
"
#{
project
.
full_path
}
#
#{
issue
.
iid
}
"
,
'path'
=>
"/
#{
project
.
full_path
}
/issues/
#{
issue
.
iid
}
"
,
'relation_path'
=>
"/groups/
#{
group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
/issues/
#{
epic_issues
.
id
}
"
'relation_path'
=>
"/groups/
#{
group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
/issues/
#{
epic_issue
.
id
}
"
,
'epic_issue_id'
=>
epic_issue
.
id
}
]
expect
(
JSON
.
parse
(
response
.
body
)).
to
eq
(
expected_result
)
...
...
spec/ee/spec/features/epics/epic_issues_spec.rb
View file @
47c12680
...
...
@@ -13,8 +13,8 @@ describe 'Epic Issues', :js do
let!
(
:epic_issues
)
do
[
create
(
:epic_issue
,
epic:
epic
,
issue:
public_issue
,
position:
1
),
create
(
:epic_issue
,
epic:
epic
,
issue:
private_issue
,
position:
2
)
create
(
:epic_issue
,
epic:
epic
,
issue:
public_issue
,
relative_
position:
1
),
create
(
:epic_issue
,
epic:
epic
,
issue:
private_issue
,
relative_
position:
2
)
]
end
...
...
spec/factories/epic_issues.rb
View file @
47c12680
...
...
@@ -2,6 +2,6 @@ FactoryBot.define do
factory
:epic_issue
do
epic
issue
relative_position
Gitlab
::
Database
::
MAX_INT_VALUE
/
2
relative_position
{
Gitlab
::
Database
::
MAX_INT_VALUE
/
2
}
end
end
spec/migrations/schedule_populate_merge_request_metrics_with_events_data_spec.rb
View file @
47c12680
...
...
@@ -12,10 +12,10 @@ describe SchedulePopulateMergeRequestMetricsWithEventsData, :migration, :sidekiq
migrate!
expect
(
described_class
::
MIGRATION
)
.
to
be_scheduled_migration
(
10
.
minutes
,
mrs
.
first
.
id
,
mrs
.
second
.
id
)
.
to
be_scheduled_
delayed_
migration
(
10
.
minutes
,
mrs
.
first
.
id
,
mrs
.
second
.
id
)
expect
(
described_class
::
MIGRATION
)
.
to
be_scheduled_migration
(
20
.
minutes
,
mrs
.
third
.
id
,
mrs
.
third
.
id
)
.
to
be_scheduled_
delayed_
migration
(
20
.
minutes
,
mrs
.
third
.
id
,
mrs
.
third
.
id
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
(
2
)
end
...
...
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