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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
5ba9279c
Commit
5ba9279c
authored
Jun 13, 2018
by
Jan
Committed by
Rémy Coutable
Jun 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Add `/confidential` quick action for issues"
parent
031ee142
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
0 deletions
+71
-0
app/services/quick_actions/interpret_service.rb
app/services/quick_actions/interpret_service.rb
+11
-0
changelogs/unreleased/47145-quick-actions-confidential.yml
changelogs/unreleased/47145-quick-actions-confidential.yml
+5
-0
doc/user/project/quick_actions.md
doc/user/project/quick_actions.md
+1
-0
spec/features/issues/user_uses_slash_commands_spec.rb
spec/features/issues/user_uses_slash_commands_spec.rb
+36
-0
spec/services/quick_actions/interpret_service_spec.rb
spec/services/quick_actions/interpret_service_spec.rb
+18
-0
No files found.
app/services/quick_actions/interpret_service.rb
View file @
5ba9279c
...
...
@@ -561,6 +561,17 @@ module QuickActions
end
end
desc
'Make issue confidential.'
explanation
do
'Makes this issue confidential'
end
condition
do
issuable
.
is_a?
(
Issue
)
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
end
command
:confidential
do
@updates
[
:confidential
]
=
true
end
def
extract_users
(
params
)
return
[]
if
params
.
nil?
...
...
changelogs/unreleased/47145-quick-actions-confidential.yml
0 → 100644
View file @
5ba9279c
---
title
:
Add /confidential quick action
merge_request
:
author
:
Jan Beckmann
type
:
added
doc/user/project/quick_actions.md
View file @
5ba9279c
...
...
@@ -42,3 +42,4 @@ do.
|
`/tableflip`
| Append the comment with
`(╯°□°)╯︵ ┻━┻`
|
|
`/shrug`
| Append the comment with
`¯\_(ツ)_/¯`
|
|
<code>
/copy_metadata #issue
|
!merge_request
</code>
| Copy labels and milestone from other issue or merge request |
|
`/confidential`
| Makes the issue confidential |
\ No newline at end of file
spec/features/issues/user_uses_slash_commands_spec.rb
View file @
5ba9279c
...
...
@@ -153,6 +153,42 @@ feature 'Issues > User uses quick actions', :js do
end
end
describe
'make issue confidential'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:original_issue
)
{
create
(
:issue
,
project:
project
)
}
context
'when the current user can update issues'
do
it
'does not create a note, and marks the issue as confidential'
do
add_note
(
"/confidential"
)
expect
(
page
).
not_to
have_content
"/confidential"
expect
(
page
).
to
have_content
'Commands applied'
expect
(
page
).
to
have_content
"made the issue confidential"
expect
(
issue
.
reload
).
to
be_confidential
end
end
context
'when the current user cannot update the issue'
do
let
(
:guest
)
{
create
(
:user
)
}
before
do
project
.
add_guest
(
guest
)
gitlab_sign_out
sign_in
(
guest
)
visit
project_issue_path
(
project
,
issue
)
end
it
'does not create a note, and does not mark the issue as confidential'
do
add_note
(
"/confidential"
)
expect
(
page
).
not_to
have_content
'Commands applied'
expect
(
page
).
not_to
have_content
"made the issue confidential"
expect
(
issue
.
reload
).
not_to
be_confidential
end
end
end
describe
'move the issue to another project'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
...
...
spec/services/quick_actions/interpret_service_spec.rb
View file @
5ba9279c
...
...
@@ -323,6 +323,14 @@ describe QuickActions::InterpretService do
end
end
shared_examples
'confidential command'
do
it
'marks issue as confidential if content contains /confidential'
do
_
,
updates
=
service
.
execute
(
content
,
issuable
)
expect
(
updates
).
to
eq
(
confidential:
true
)
end
end
shared_examples
'shrug command'
do
it
'appends ¯\_(ツ)_/¯ to the comment'
do
new_content
,
_
=
service
.
execute
(
content
,
issuable
)
...
...
@@ -774,6 +782,11 @@ describe QuickActions::InterpretService do
let
(
:issuable
)
{
issue
}
end
it_behaves_like
'confidential command'
do
let
(
:content
)
{
'/confidential'
}
let
(
:issuable
)
{
issue
}
end
context
'/copy_metadata command'
do
let
(
:todo_label
)
{
create
(
:label
,
project:
project
,
title:
'To Do'
)
}
let
(
:inreview_label
)
{
create
(
:label
,
project:
project
,
title:
'In Review'
)
}
...
...
@@ -918,6 +931,11 @@ describe QuickActions::InterpretService do
let
(
:issuable
)
{
issue
}
end
it_behaves_like
'empty command'
do
let
(
:content
)
{
'/confidential'
}
let
(
:issuable
)
{
issue
}
end
it_behaves_like
'empty command'
do
let
(
:content
)
{
'/duplicate #{issue.to_reference}'
}
let
(
:issuable
)
{
issue
}
...
...
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