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
d61acd6d
Commit
d61acd6d
authored
May 16, 2018
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow viewing only one board when multiple issue boards is not enabled
parent
87aef527
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
8 deletions
+88
-8
app/controllers/groups/boards_controller.rb
app/controllers/groups/boards_controller.rb
+8
-3
app/controllers/projects/boards_controller.rb
app/controllers/projects/boards_controller.rb
+6
-3
ee/app/services/ee/boards/list_service.rb
ee/app/services/ee/boards/list_service.rb
+5
-1
ee/changelogs/unreleased/issue_5128.yml
ee/changelogs/unreleased/issue_5128.yml
+5
-0
ee/spec/controllers/groups/boards_controller_spec.rb
ee/spec/controllers/groups/boards_controller_spec.rb
+8
-0
ee/spec/controllers/projects/boards_controller_spec.rb
ee/spec/controllers/projects/boards_controller_spec.rb
+7
-1
ee/spec/support/shared_examples/controllers/multiple_issue_board_show.rb
.../shared_examples/controllers/multiple_issue_board_show.rb
+49
-0
No files found.
app/controllers/groups/boards_controller.rb
View file @
d61acd6d
...
...
@@ -3,19 +3,24 @@ class Groups::BoardsController < Groups::ApplicationController
include
BoardsResponses
before_action
:assign_endpoint_vars
before_action
:boards
,
only: :index
def
index
@boards
=
Boards
::
ListService
.
new
(
group
,
current_user
).
execute
respond_with_boards
end
def
show
@board
=
group
.
boards
.
find
(
params
[
:id
])
@board
=
boards
.
find
(
params
[
:id
])
respond_with_board
end
private
def
boards
@boards
||=
Boards
::
ListService
.
new
(
group
,
current_user
).
execute
end
def
assign_endpoint_vars
@boards_endpoint
=
group_boards_url
(
group
)
@namespace_path
=
group
.
to_param
...
...
app/controllers/projects/boards_controller.rb
View file @
d61acd6d
...
...
@@ -5,22 +5,25 @@ class Projects::BoardsController < Projects::ApplicationController
before_action
:check_issues_available!
before_action
:authorize_read_board!
,
only:
[
:index
,
:show
]
before_action
:boards
,
only: :index
before_action
:assign_endpoint_vars
def
index
@boards
=
Boards
::
ListService
.
new
(
project
,
current_user
).
execute
respond_with_boards
end
def
show
@board
=
project
.
boards
.
find
(
params
[
:id
])
@board
=
boards
.
find
(
params
[
:id
])
respond_with_board
end
private
def
boards
@boards
||=
Boards
::
ListService
.
new
(
project
,
current_user
).
execute
end
def
assign_endpoint_vars
@boards_endpoint
=
project_boards_path
(
project
)
@bulk_issues_path
=
bulk_update_project_issues_path
(
project
)
...
...
ee/app/services/ee/boards/list_service.rb
View file @
d61acd6d
...
...
@@ -8,7 +8,11 @@ module EE
if
parent
.
multiple_issue_boards_available?
super
else
super
.
limit
(
1
)
# When multiple issue boards is not available
# user is only allowed to view the default shown board
# We could use just one query but MYSQL does not support nested queries using LIMIT.
boards
.
where
(
id:
super
.
first
).
reorder
(
nil
)
end
end
...
...
ee/changelogs/unreleased/issue_5128.yml
0 → 100644
View file @
d61acd6d
---
title
:
Allow viewing only one when multiple issue boards is not enabled
merge_request
:
author
:
type
:
other
ee/spec/controllers/groups/boards_controller_spec.rb
View file @
d61acd6d
...
...
@@ -51,4 +51,12 @@ describe Groups::BoardsController do
get
:index
,
group_id:
group
,
format:
format
end
end
describe
'GET show'
do
context
'for multiple issue boards'
do
let
(
:parent
)
{
group
}
it_behaves_like
'multiple issue boards show'
end
end
end
ee/spec/controllers/projects/boards_controller_spec.rb
View file @
d61acd6d
...
...
@@ -36,6 +36,12 @@ describe Projects::BoardsController do
end
end
describe
'GET show'
do
let
(
:parent
)
{
project
}
it_behaves_like
'multiple issue boards show'
end
describe
'POST create'
do
context
'with the multiple issue boards available'
do
before
do
...
...
@@ -102,7 +108,7 @@ describe Projects::BoardsController do
end
it
'renders a 404 when multiple issue boards are not available'
do
stub_licensed_features
(
multiple_issue_boards:
false
)
stub_licensed_features
(
multiple_
project_
issue_boards:
false
)
create_board
name:
'Backend'
...
...
ee/spec/support/shared_examples/controllers/multiple_issue_board_show.rb
0 → 100644
View file @
d61acd6d
require
'spec_helper'
shared_examples
'multiple issue boards show'
do
let!
(
:board1
)
{
create
(
:board
,
parent:
parent
,
name:
'b'
)
}
let!
(
:board2
)
{
create
(
:board
,
parent:
parent
,
name:
'a'
)
}
context
'when multiple issue boards is enabled'
do
it
'let user view any board from parent'
do
[
board1
,
board2
].
each
do
|
board
|
show
(
board
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
assigns
(
:board
)).
to
eq
(
board
)
end
end
end
context
'when multiple issue boards is disabled'
do
before
do
stub_licensed_features
(
multiple_project_issue_boards:
false
,
multiple_group_issue_boards:
false
)
end
it
'let user view the default shown board'
do
show
(
board2
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
assigns
(
:board
)).
to
eq
(
board2
)
end
it
'renders 404 when board is not the default'
do
show
(
board1
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
def
show
(
board
)
params
=
{}
params
[
:id
]
=
board
.
to_param
if
board
.
group_board?
params
[
:group_id
]
=
parent
else
params
.
merge!
(
namespace_id:
parent
.
namespace
,
project_id:
parent
)
end
get
:show
,
params
end
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