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
2240c5e4
Commit
2240c5e4
authored
Jul 30, 2020
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to hide boards closed and backlog lists
Persist options to hide boards backlog and closed lists on database.
parent
609d185d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
85 additions
and
22 deletions
+85
-22
changelogs/unreleased/issue_218031_be.yml
changelogs/unreleased/issue_218031_be.yml
+5
-0
db/migrate/20200730131946_add_hide_lists_to_boards.rb
db/migrate/20200730131946_add_hide_lists_to_boards.rb
+10
-0
db/schema_migrations/20200730131946
db/schema_migrations/20200730131946
+1
-0
db/structure.sql
db/structure.sql
+3
-1
ee/app/models/ee/list.rb
ee/app/models/ee/list.rb
+2
-0
ee/app/services/ee/boards/lists/list_service.rb
ee/app/services/ee/boards/lists/list_service.rb
+18
-10
ee/app/services/ee/boards/update_service.rb
ee/app/services/ee/boards/update_service.rb
+2
-0
ee/spec/models/ee/list_spec.rb
ee/spec/models/ee/list_spec.rb
+13
-0
ee/spec/services/boards/update_service_spec.rb
ee/spec/services/boards/update_service_spec.rb
+7
-11
ee/spec/services/ee/boards/lists/list_service_spec.rb
ee/spec/services/ee/boards/lists/list_service_spec.rb
+22
-0
spec/lib/gitlab/import_export/safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+2
-0
No files found.
changelogs/unreleased/issue_218031_be.yml
0 → 100644
View file @
2240c5e4
---
title
:
Add hide_backlog_list and hide_closed_list attributes to boards table
merge_request
:
38303
author
:
type
:
added
db/migrate/20200730131946_add_hide_lists_to_boards.rb
0 → 100644
View file @
2240c5e4
# frozen_string_literal: true
class
AddHideListsToBoards
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
def
change
add_column
:boards
,
:hide_backlog_list
,
:boolean
,
default:
false
,
null:
false
add_column
:boards
,
:hide_closed_list
,
:boolean
,
default:
false
,
null:
false
end
end
db/schema_migrations/20200730131946
0 → 100644
View file @
2240c5e4
4ef0dfb9cdeccd57a3c11d1db0b57448746237d4a1fe001340575c996a6c3c68
\ No newline at end of file
db/structure.sql
View file @
2240c5e4
...
...
@@ -9660,7 +9660,9 @@ CREATE TABLE public.boards (
name
character
varying
DEFAULT
'Development'
::
character
varying
NOT
NULL
,
milestone_id
integer
,
group_id
integer
,
weight
integer
weight
integer
,
hide_backlog_list
boolean
DEFAULT
false
NOT
NULL
,
hide_closed_list
boolean
DEFAULT
false
NOT
NULL
);
CREATE
SEQUENCE
public
.
boards_id_seq
...
...
ee/app/models/ee/list.rb
View file @
2240c5e4
...
...
@@ -37,6 +37,8 @@ module EE
base
.
validates
:list_type
,
exclusion:
{
in:
%w[milestone]
,
message:
_
(
'Milestone lists not available with your current license'
)
},
unless:
->
{
board
&
.
resource_parent
&
.
feature_available?
(
:board_milestone_lists
)
}
base
.
scope
:without_types
,
->
(
list_types
)
{
where
.
not
(
list_type:
list_types
)
}
end
def
assignee
=
(
user
)
...
...
ee/app/services/ee/boards/lists/list_service.rb
View file @
2240c5e4
...
...
@@ -12,24 +12,32 @@ module EE
override
:execute
def
execute
(
board
,
create_default_lists:
true
)
not_available_lists
=
list_type_features_availability
(
board
)
.
select
{
|
_
,
available
|
!
available
}
list_types
=
unavailable_list_types_for
(
board
)
if
not_available_lists
.
any?
super
.
where
.
not
(
list_type:
not_available_lists
.
keys
)
# rubocop: disable CodeReuse/ActiveRecord
else
super
end
super
.
without_types
(
list_types
)
end
private
def
list_type_features_availability
(
board
)
def
unavailable_list_types_for
(
board
)
(
hidden_lists_for
(
board
)
+
unlicensed_lists_for
(
board
)).
uniq
end
def
hidden_lists_for
(
board
)
hidden
=
[]
hidden
<<
::
List
.
list_types
[
:backlog
]
if
board
.
hide_backlog_list
hidden
<<
::
List
.
list_types
[
:closed
]
if
board
.
hide_closed_list
hidden
end
def
unlicensed_lists_for
(
board
)
parent
=
board
.
resource_parent
LICENSED_LIST_TYPES
.
each_with_object
(
{})
do
|
list_type
,
hash
|
LICENSED_LIST_TYPES
.
each_with_object
(
[])
do
|
list_type
,
lists
|
list_type_key
=
::
List
.
list_types
[
list_type
]
hash
[
list_type_key
]
=
parent
&
.
feature_available?
(
:"board_
#{
list_type
}
_lists"
)
lists
<<
list_type_key
unless
parent
&
.
feature_available?
(
:"board_
#{
list_type
}
_lists"
)
end
end
end
...
...
ee/app/services/ee/boards/update_service.rb
View file @
2240c5e4
...
...
@@ -12,6 +12,8 @@ module EE
params
.
delete
(
:assignee_id
)
params
.
delete
(
:label_ids
)
params
.
delete
(
:weight
)
params
.
delete
(
:hide_backlog_list
)
params
.
delete
(
:hide_closed_list
)
end
set_assignee
...
...
ee/spec/models/ee/list_spec.rb
View file @
2240c5e4
...
...
@@ -35,6 +35,19 @@ RSpec.describe List do
end
end
describe
'.without_types'
do
it
'exclude lists of given types'
do
board
=
create
(
:list
,
list_type: :label
).
board
# closed list is created by default
backlog_list
=
create
(
:list
,
list_type: :backlog
,
board:
board
)
exclude_type
=
[
described_class
.
list_types
[
:label
],
described_class
.
list_types
[
:closed
]]
lists
=
described_class
.
without_types
(
exclude_type
)
expect
(
lists
.
where
(
board:
board
)).
to
match_array
([
backlog_list
])
end
end
context
'when it is a milestone type'
do
let
(
:milestone
)
{
build
(
:milestone
,
title:
'awesome-release'
)
}
...
...
ee/spec/services/boards/update_service_spec.rb
View file @
2240c5e4
...
...
@@ -34,28 +34,24 @@ RSpec.describe Boards::UpdateService, services: true do
milestone
=
create
(
:milestone
,
group:
group
)
label
=
create
(
:group_label
,
group:
board
.
group
)
user
=
create
(
:user
)
params
=
{
milestone_id:
milestone
.
id
,
assignee_id:
assignee
.
id
,
label_ids:
[
label
.
id
],
hide_backlog_list:
true
,
hide_closed_list:
true
}
service
=
described_class
.
new
(
group
,
user
,
params
)
service
=
described_class
.
new
(
group
,
user
,
milestone_id:
milestone
.
id
,
assignee_id:
assignee
.
id
,
label_ids:
[
label
.
id
])
service
.
execute
(
board
)
expect
(
board
.
reload
).
to
have_attributes
(
milestone:
milestone
,
assignee:
assignee
,
labels:
[
label
])
expected_attributes
=
{
milestone:
milestone
,
assignee:
assignee
,
labels:
[
label
],
hide_backlog_list:
true
,
hide_closed_list:
true
}
expect
(
board
.
reload
).
to
have_attributes
(
expected_attributes
)
end
it
'filters unpermitted params when scoped issue board is not enabled'
do
stub_licensed_features
(
scoped_issue_board:
false
)
params
=
{
milestone_id:
double
,
assignee_id:
double
,
label_ids:
double
,
weight:
double
}
params
=
{
milestone_id:
double
,
assignee_id:
double
,
label_ids:
double
,
weight:
double
,
hide_backlog_list:
true
,
hide_closed_list:
true
}
service
=
described_class
.
new
(
project
,
double
,
params
)
service
.
execute
(
board
)
expect
(
board
.
reload
).
to
have_attributes
(
milestone:
nil
,
assignee:
nil
,
labels:
[])
expected_attributes
=
{
milestone:
nil
,
assignee:
nil
,
labels:
[],
hide_backlog_list:
false
,
hide_closed_list:
false
}
expect
(
board
.
reload
).
to
have_attributes
(
expected_attributes
)
end
it_behaves_like
'setting a milestone scope'
do
...
...
ee/spec/services/ee/boards/lists/list_service_spec.rb
View file @
2240c5e4
...
...
@@ -51,6 +51,26 @@ RSpec.describe Boards::Lists::ListService do
end
end
shared_examples
'hidden lists'
do
let!
(
:list
)
{
create
(
:list
,
board:
board
,
label:
label
)
}
context
'when hide_backlog_list is true'
do
it
'hides backlog list'
do
board
.
update
(
hide_backlog_list:
true
)
expect
(
service
.
execute
(
board
)).
to
match_array
([
board
.
closed_list
,
list
])
end
end
context
'when hide_closed_list is true'
do
it
'hides closed list'
do
board
.
update
(
hide_closed_list:
true
)
expect
(
service
.
execute
(
board
)).
to
match_array
([
board
.
backlog_list
,
list
])
end
end
end
context
'when board parent is a project'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
...
...
@@ -60,6 +80,7 @@ RSpec.describe Boards::Lists::ListService do
it_behaves_like
'list service for board with assignee lists'
it_behaves_like
'list service for board with milestone lists'
it_behaves_like
'hidden lists'
end
context
'when board parent is a group'
do
...
...
@@ -71,6 +92,7 @@ RSpec.describe Boards::Lists::ListService do
it_behaves_like
'list service for board with assignee lists'
it_behaves_like
'list service for board with milestone lists'
it_behaves_like
'hidden lists'
end
end
end
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
2240c5e4
...
...
@@ -737,6 +737,8 @@ Board:
-
milestone_id
-
weight
-
name
-
hide_backlog_list
-
hide_closed_list
List
:
-
id
-
board_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