BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
cfcd1601
Commit
cfcd1601
authored
Aug 07, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add-assign-me-alias' into 'master'
Add `/assign me` alias support for assigning issuables to oneself Closes #35304 See merge request !13334
parents
c1a8cffe
74f8b5c3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
6 deletions
+42
-6
interpret_service.rb
app/services/quick_actions/interpret_service.rb
+6
-1
user_uses_slash_commands_spec.rb
.../features/merge_requests/user_uses_slash_commands_spec.rb
+5
-5
interpret_service_spec.rb
spec/services/quick_actions/interpret_service_spec.rb
+20
-0
issuable_slash_commands_shared_examples.rb
...pport/features/issuable_slash_commands_shared_examples.rb
+11
-0
No files found.
app/services/quick_actions/interpret_service.rb
View file @
cfcd1601
...
...
@@ -511,7 +511,12 @@ module QuickActions
users
=
extract_references
(
params
,
:user
)
if
users
.
empty?
users
=
User
.
where
(
username:
params
.
split
(
' '
).
map
(
&
:strip
))
users
=
if
params
==
'me'
[
current_user
]
else
User
.
where
(
username:
params
.
split
(
' '
).
map
(
&
:strip
))
end
end
users
...
...
spec/features/merge_requests/user_uses_slash_commands_spec.rb
View file @
cfcd1601
...
...
@@ -3,17 +3,17 @@ require 'rails_helper'
feature
'Merge Requests > User uses quick actions'
,
js:
true
do
include
QuickActionsHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
,
title:
'ASAP'
)
}
it_behaves_like
'issuable record that supports quick actions in its description and notes'
,
:merge_request
do
let
(
:issuable
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:new_url_opts
)
{
{
merge_request:
{
source_branch:
'feature'
,
target_branch:
'master'
}
}
}
end
describe
'merge-request-only commands'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
,
title:
'ASAP'
)
}
before
do
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
...
...
spec/services/quick_actions/interpret_service_spec.rb
View file @
cfcd1601
...
...
@@ -424,6 +424,26 @@ describe QuickActions::InterpretService do
end
end
context
'assign command with me alias'
do
let
(
:content
)
{
"/assign me"
}
context
'Issue'
do
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
_
,
updates
=
service
.
execute
(
content
,
issue
)
expect
(
updates
).
to
eq
(
assignee_ids:
[
developer
.
id
])
end
end
context
'Merge Request'
do
it
'fetches assignee and populates assignee_ids if content contains /assign'
do
_
,
updates
=
service
.
execute
(
content
,
merge_request
)
expect
(
updates
).
to
eq
(
assignee_ids:
[
developer
.
id
])
end
end
end
it_behaves_like
'empty command'
do
let
(
:content
)
{
'/assign @abcd1234'
}
let
(
:issuable
)
{
issue
}
...
...
spec/support/features/issuable_slash_commands_shared_examples.rb
View file @
cfcd1601
...
...
@@ -279,6 +279,17 @@ shared_examples 'issuable record that supports quick actions in its description
expect
(
issuable
.
subscribed?
(
master
,
project
)).
to
be_falsy
end
end
context
"with a note assigning the
#{
issuable_type
}
to the current user"
do
it
"assigns the
#{
issuable_type
}
to the current user"
do
write_note
(
"/assign me"
)
expect
(
page
).
not_to
have_content
'/assign me'
expect
(
page
).
to
have_content
'Commands applied'
expect
(
issuable
.
reload
.
assignees
).
to
eq
[
master
]
end
end
end
describe
"preview of note on
#{
issuable_type
}
"
do
...
...
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