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
5dedc534
Commit
5dedc534
authored
Jul 27, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issues list for group boards
parent
65d4a288
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
16 deletions
+23
-16
app/controllers/groups/boards_controller.rb
app/controllers/groups/boards_controller.rb
+1
-1
app/controllers/projects/boards_controller.rb
app/controllers/projects/boards_controller.rb
+1
-1
app/models/label.rb
app/models/label.rb
+3
-1
app/services/boards/base_service.rb
app/services/boards/base_service.rb
+0
-1
app/services/boards/issues/list_service.rb
app/services/boards/issues/list_service.rb
+5
-4
app/services/boards/issues/move_service.rb
app/services/boards/issues/move_service.rb
+5
-3
app/services/boards/lists/create_service.rb
app/services/boards/lists/create_service.rb
+6
-3
app/services/boards/lists/generate_service.rb
app/services/boards/lists/generate_service.rb
+2
-2
No files found.
app/controllers/groups/boards_controller.rb
View file @
5dedc534
...
...
@@ -3,7 +3,7 @@ class Groups::BoardsController < Groups::ApplicationController
before_action
:assign_endpoint_vars
def
index
@boards
=
::
Boards
::
ListService
.
new
(
group
,
current_user
).
execute
@boards
=
Boards
::
ListService
.
new
(
group
,
current_user
).
execute
respond_to
do
|
format
|
format
.
html
...
...
app/controllers/projects/boards_controller.rb
View file @
5dedc534
...
...
@@ -6,7 +6,7 @@ class Projects::BoardsController < Projects::ApplicationController
before_action
:assign_endpoint_vars
def
index
@boards
=
::
Boards
::
ListService
.
new
(
project
,
current_user
).
execute
@boards
=
Boards
::
ListService
.
new
(
project
,
current_user
).
execute
respond_to
do
|
format
|
format
.
html
...
...
app/models/label.rb
View file @
5dedc534
...
...
@@ -34,7 +34,9 @@ class Label < ActiveRecord::Base
scope
:templates
,
->
{
where
(
template:
true
)
}
scope
:with_title
,
->
(
title
)
{
where
(
title:
title
)
}
scope
:on_project_boards
,
->
(
project_id
)
{
joins
(
lists: :board
).
merge
(
List
.
movable
).
where
(
boards:
{
project_id:
project_id
})
}
scope
:with_lists_and_board
,
->
{
joins
(
lists: :board
).
merge
(
List
.
movable
)
}
scope
:on_project_boards
,
->
(
project_id
)
{
with_lists_and_board
.
where
(
boards:
{
project_id:
project_id
})
}
scope
:on_group_boards
,
->
(
group_id
)
{
with_lists_and_board
.
where
(
boards:
{
group_id:
group_id
})
}
def
self
.
prioritized
(
project
)
joins
(
:priorities
)
...
...
app/services/boards/base_service.rb
View file @
5dedc534
...
...
@@ -5,7 +5,6 @@ module Boards
def
initialize
(
parent
,
user
,
params
=
{})
@parent
,
@current_user
,
@params
=
parent
,
user
,
params
.
dup
super
end
end
end
app/services/boards/issues/list_service.rb
View file @
5dedc534
...
...
@@ -11,7 +11,7 @@ module Boards
private
def
board
@board
||=
p
rojec
t
.
boards
.
find
(
params
[
:board_id
])
@board
||=
p
aren
t
.
boards
.
find
(
params
[
:board_id
])
end
def
list
...
...
@@ -34,7 +34,7 @@ module Boards
def
filter_params
set_default_scope
set_p
rojec
t
set_p
aren
t
set_state
params
...
...
@@ -44,8 +44,9 @@ module Boards
params
[
:scope
]
=
'all'
end
def
set_project
params
[
:project_id
]
=
project
.
id
def
set_parent
param_key
=
parent
.
is_a?
(
Group
)
?
:group_id
:
:project_id
params
[
param_key
]
=
parent
.
id
end
def
set_state
...
...
app/services/boards/issues/move_service.rb
View file @
5dedc534
...
...
@@ -11,7 +11,7 @@ module Boards
private
def
board
@board
||=
p
rojec
t
.
boards
.
find
(
params
[
:board_id
])
@board
||=
p
aren
t
.
boards
.
find
(
params
[
:board_id
])
end
def
move_between_lists?
...
...
@@ -28,7 +28,7 @@ module Boards
end
def
update_service
::
Issues
::
UpdateService
.
new
(
projec
t
,
current_user
,
issue_params
)
::
Issues
::
UpdateService
.
new
(
board
.
paren
t
,
current_user
,
issue_params
)
end
def
issue_params
...
...
@@ -60,8 +60,10 @@ module Boards
label_ids
=
if
moving_to_list
.
movable?
moving_from_list
.
label_id
elsif
board
.
is_group_board?
Label
.
on_group_boards
(
parent
.
id
).
pluck
(
:label_id
)
else
Label
.
on_project_boards
(
p
rojec
t
.
id
).
pluck
(
:label_id
)
Label
.
on_project_boards
(
p
aren
t
.
id
).
pluck
(
:label_id
)
end
Array
(
label_ids
).
compact
...
...
app/services/boards/lists/create_service.rb
View file @
5dedc534
...
...
@@ -3,7 +3,7 @@ module Boards
class
CreateService
<
BaseService
def
execute
(
board
)
List
.
transaction
do
label
=
available_labels
.
find
(
params
[
:label_id
])
label
=
available_labels
_for
(
board
)
.
find
(
params
[
:label_id
])
position
=
next_position
(
board
)
create_list
(
board
,
label
,
position
)
...
...
@@ -12,8 +12,11 @@ module Boards
private
def
available_labels
LabelsFinder
.
new
(
current_user
,
project_id:
project
.
id
).
execute
def
available_labels_for
(
board
)
label_params
=
board
.
is_group_board?
?
{
group_id:
parent
.
id
}
:
{
project_id:
parent
.
id
}
LabelsFinder
.
new
(
current_user
,
label_params
).
execute
end
def
next_position
(
board
)
...
...
app/services/boards/lists/generate_service.rb
View file @
5dedc534
...
...
@@ -15,11 +15,11 @@ module Boards
def
create_list
(
board
,
params
)
label
=
find_or_create_label
(
params
)
Lists
::
CreateService
.
new
(
p
rojec
t
,
current_user
,
label_id:
label
.
id
).
execute
(
board
)
Lists
::
CreateService
.
new
(
p
aren
t
,
current_user
,
label_id:
label
.
id
).
execute
(
board
)
end
def
find_or_create_label
(
params
)
::
Labels
::
FindOrCreateService
.
new
(
current_user
,
p
rojec
t
,
params
).
execute
::
Labels
::
FindOrCreateService
.
new
(
current_user
,
p
aren
t
,
params
).
execute
end
def
label_params
...
...
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