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
dcf55400
Commit
dcf55400
authored
Sep 11, 2020
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide test cases from issues list
Hide test cases issues from issues list
parent
a1f13438
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
5 deletions
+32
-5
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+5
-3
app/models/issue.rb
app/models/issue.rb
+5
-0
app/services/projects/open_issues_count_service.rb
app/services/projects/open_issues_count_service.rb
+4
-2
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+10
-0
spec/services/projects/open_issues_count_service_spec.rb
spec/services/projects/open_issues_count_service_spec.rb
+8
-0
No files found.
app/controllers/projects/issues_controller.rb
View file @
dcf55400
...
...
@@ -344,10 +344,12 @@ class Projects::IssuesController < Projects::ApplicationController
def
finder_options
options
=
super
return
options
unless
service_desk?
options
[
:issue_types
]
=
Issue
::
TYPES_FOR_LIST
options
.
reject!
{
|
key
|
key
==
'author_username'
||
key
==
'author_id'
}
options
[
:author_id
]
=
User
.
support_bot
if
service_desk?
options
.
reject!
{
|
key
|
key
==
'author_username'
||
key
==
'author_id'
}
options
[
:author_id
]
=
User
.
support_bot
end
options
end
...
...
app/models/issue.rb
View file @
dcf55400
...
...
@@ -30,6 +30,11 @@ class Issue < ApplicationRecord
SORTING_PREFERENCE_FIELD
=
:issues_sort
# Types of issues that should be displayed on lists across the app
# for example, project issues list, group issues list and issue boards.
# Some issue types, like test cases, should be hidden by default.
TYPES_FOR_LIST
=
%w(issue incident)
.
freeze
belongs_to
:project
has_one
:namespace
,
through: :project
...
...
app/services/projects/open_issues_count_service.rb
View file @
dcf55400
...
...
@@ -68,10 +68,12 @@ module Projects
# Check https://gitlab.com/gitlab-org/gitlab-foss/issues/38418 description.
# rubocop: disable CodeReuse/ActiveRecord
def
self
.
query
(
projects
,
public_only:
true
)
issues_filtered_by_type
=
Issue
.
opened
.
with_issue_type
(
Issue
::
TYPES_FOR_LIST
)
if
public_only
Issue
.
opened
.
public_only
.
where
(
project:
projects
)
issues_filtered_by_type
.
public_only
.
where
(
project:
projects
)
else
Issue
.
opened
.
where
(
project:
projects
)
issues_filtered_by_type
.
where
(
project:
projects
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
dcf55400
...
...
@@ -82,6 +82,16 @@ RSpec.describe Projects::IssuesController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'returns only list type issues'
do
issue
=
create
(
:issue
,
project:
project
)
incident
=
create
(
:issue
,
project:
project
,
issue_type:
'incident'
)
create
(
:issue
,
project:
project
,
issue_type:
'test_case'
)
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
assigns
(
:issues
)).
to
contain_exactly
(
issue
,
incident
)
end
it
"returns 301 if request path doesn't match project path"
do
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
.
path
.
upcase
}
...
...
spec/services/projects/open_issues_count_service_spec.rb
View file @
dcf55400
...
...
@@ -10,6 +10,14 @@ RSpec.describe Projects::OpenIssuesCountService, :use_clean_rails_memory_store_c
it_behaves_like
'a counter caching service'
describe
'#count'
do
it
'does not count test cases'
do
create
(
:issue
,
:opened
,
project:
project
)
create
(
:incident
,
:opened
,
project:
project
)
create
(
:quality_test_case
,
:opened
,
project:
project
)
expect
(
described_class
.
new
(
project
).
count
).
to
eq
(
2
)
end
context
'when user is nil'
do
it
'does not include confidential issues in the issue count'
do
create
(
:issue
,
:opened
,
project:
project
)
...
...
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