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
57a36570
Commit
57a36570
authored
Mar 16, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow passing include_confidential for find_by_id
parent
59d90368
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
ee/app/finders/status_page/incidents_finder.rb
ee/app/finders/status_page/incidents_finder.rb
+5
-3
ee/spec/finders/status_page/incidents_finder_spec.rb
ee/spec/finders/status_page/incidents_finder_spec.rb
+25
-11
No files found.
ee/app/finders/status_page/incidents_finder.rb
View file @
57a36570
...
...
@@ -10,8 +10,10 @@
#
# finder = StatusPage::IncidentsFinder.new(project_id: project_id)
#
# # A single issue
(including confidential issue
)
# # A single issue
which includes confidential issues by default
)
# issue = finder.find_by_id(issue_id)
# # Find a "public only" issue
# issue = finder.find_by_id(issue_id, include_confidential: false)
#
# # Most recent 20 non-confidential issues
# issues = finder.all
...
...
@@ -24,8 +26,8 @@ module StatusPage
@project_id
=
project_id
end
def
find_by_id
(
issue_id
)
execute
(
include_confidential:
true
)
def
find_by_id
(
issue_id
,
include_confidential:
true
)
execute
(
include_confidential:
include_confidential
)
.
find_by_id
(
issue_id
)
end
...
...
ee/spec/finders/status_page/incidents_finder_spec.rb
View file @
57a36570
...
...
@@ -17,24 +17,38 @@ describe StatusPage::IncidentsFinder do
let
(
:finder
)
{
described_class
.
new
(
project_id:
project
.
id
)
}
describe
'#find_by_id'
do
subject
{
finder
.
find_by_id
(
issue
.
id
)
}
subject
{
finder
.
find_by_id
(
issue
.
id
,
**
params
)
}
context
'
for public issue
'
do
let
(
:
issue
)
{
public_issues
.
first
}
context
'
without params
'
do
let
(
:
params
)
{
{}
}
it
{
is_expected
.
to
eq
(
issue
)
}
end
context
'for public issue'
do
let
(
:issue
)
{
public_issues
.
first
}
it
{
is_expected
.
to
eq
(
issue
)
}
end
context
'for confidential issue'
do
let
(
:issue
)
{
issues
.
fetch
(
:confidential
)
}
context
'for confidential issue'
do
let
(
:issue
)
{
issues
.
fetch
(
:confidential
)
}
it
{
is_expected
.
to
eq
(
issue
)
}
end
it
{
is_expected
.
to
eq
(
issue
)
}
context
'for unrelated issue'
do
let
(
:issue
)
{
issues
.
fetch
(
:unrelated
)
}
it
{
is_expected
.
to
be_nil
}
end
end
context
'
for unrelated issue
'
do
let
(
:
issue
)
{
issues
.
fetch
(
:unrelated
)
}
context
'
with include_confidential
'
do
let
(
:
params
)
{
{
include_confidential:
false
}
}
it
{
is_expected
.
to
be_nil
}
context
'for confidential issue'
do
let
(
:issue
)
{
issues
.
fetch
(
:confidential
)
}
it
{
is_expected
.
to
be_nil
}
end
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