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
7a6ecbcb
Commit
7a6ecbcb
authored
Aug 13, 2019
by
Heinrich Lee Yu
Committed by
Mayra Cabrera
Aug 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve quick action error messages
Standardize punctuation and format
parent
2de17d12
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
91 additions
and
85 deletions
+91
-85
app/models/label.rb
app/models/label.rb
+2
-0
app/services/notes/create_service.rb
app/services/notes/create_service.rb
+1
-1
changelogs/unreleased/improve-quick-action-messages.yml
changelogs/unreleased/improve-quick-action-messages.yml
+5
-0
lib/gitlab/quick_actions/issuable_actions.rb
lib/gitlab/quick_actions/issuable_actions.rb
+6
-6
lib/gitlab/quick_actions/issue_actions.rb
lib/gitlab/quick_actions/issue_actions.rb
+15
-16
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
+5
-5
locale/gitlab.pot
locale/gitlab.pot
+38
-38
spec/services/quick_actions/interpret_service_spec.rb
spec/services/quick_actions/interpret_service_spec.rb
+18
-18
spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb
.../quick_actions/issue/move_quick_action_shared_examples.rb
+1
-1
No files found.
app/models/label.rb
View file @
7a6ecbcb
...
@@ -138,6 +138,8 @@ class Label < ApplicationRecord
...
@@ -138,6 +138,8 @@ class Label < ApplicationRecord
end
end
def
self
.
on_project_board?
(
project_id
,
label_id
)
def
self
.
on_project_board?
(
project_id
,
label_id
)
return
false
if
label_id
.
blank?
on_project_boards
(
project_id
).
where
(
id:
label_id
).
exists?
on_project_boards
(
project_id
).
where
(
id:
label_id
).
exists?
end
end
...
...
app/services/notes/create_service.rb
View file @
7a6ecbcb
...
@@ -53,7 +53,7 @@ module Notes
...
@@ -53,7 +53,7 @@ module Notes
# We must add the error after we call #save because errors are reset
# We must add the error after we call #save because errors are reset
# when #save is called
# when #save is called
if
only_commands
if
only_commands
note
.
errors
.
add
(
:commands_only
,
message
.
presence
||
_
(
'
Commands did not apply
'
))
note
.
errors
.
add
(
:commands_only
,
message
.
presence
||
_
(
'
Failed to apply commands.
'
))
end
end
end
end
...
...
changelogs/unreleased/improve-quick-action-messages.yml
0 → 100644
View file @
7a6ecbcb
---
title
:
Improve quick action error messages
merge_request
:
31451
author
:
type
:
other
lib/gitlab/quick_actions/issuable_actions.rb
View file @
7a6ecbcb
...
@@ -145,9 +145,9 @@ module Gitlab
...
@@ -145,9 +145,9 @@ module Gitlab
run_label_command
(
labels:
find_labels
(
labels_param
),
command: :relabel
,
updates_key: :label_ids
)
run_label_command
(
labels:
find_labels
(
labels_param
),
command: :relabel
,
updates_key: :label_ids
)
end
end
desc
_
(
'Add a
tod
o'
)
desc
_
(
'Add a
To D
o'
)
explanation
_
(
'Adds a
tod
o.'
)
explanation
_
(
'Adds a
To D
o.'
)
execution_message
_
(
'Added a
tod
o.'
)
execution_message
_
(
'Added a
To D
o.'
)
types
Issuable
types
Issuable
condition
do
condition
do
quick_action_target
.
persisted?
&&
quick_action_target
.
persisted?
&&
...
@@ -157,9 +157,9 @@ module Gitlab
...
@@ -157,9 +157,9 @@ module Gitlab
@updates
[
:todo_event
]
=
'add'
@updates
[
:todo_event
]
=
'add'
end
end
desc
_
(
'Mark
to d
o as done'
)
desc
_
(
'Mark
To D
o as done'
)
explanation
_
(
'Marks
to d
o as done.'
)
explanation
_
(
'Marks
To D
o as done.'
)
execution_message
_
(
'Marked
to d
o as done.'
)
execution_message
_
(
'Marked
To D
o as done.'
)
types
Issuable
types
Issuable
condition
do
condition
do
quick_action_target
.
persisted?
&&
quick_action_target
.
persisted?
&&
...
...
lib/gitlab/quick_actions/issue_actions.rb
View file @
7a6ecbcb
...
@@ -57,19 +57,18 @@ module Gitlab
...
@@ -57,19 +57,18 @@ module Gitlab
labels
=
find_labels
(
target_list_name
)
labels
=
find_labels
(
target_list_name
)
label_ids
=
labels
.
map
(
&
:id
)
label_ids
=
labels
.
map
(
&
:id
)
if
label_ids
.
size
==
1
if
label_ids
.
size
>
1
message
=
_
(
'Failed to move this issue because only a single label can be provided.'
)
elsif
!
Label
.
on_project_board?
(
quick_action_target
.
project_id
,
label_ids
.
first
)
message
=
_
(
'Failed to move this issue because label was not found.'
)
else
label_id
=
label_ids
.
first
label_id
=
label_ids
.
first
# Ensure this label corresponds to a list on the board
next
unless
Label
.
on_project_board?
(
quick_action_target
.
project_id
,
label_id
)
@updates
[
:remove_label_ids
]
=
@updates
[
:remove_label_ids
]
=
quick_action_target
.
labels
.
on_project_boards
(
quick_action_target
.
project_id
).
where
.
not
(
id:
label_id
).
pluck
(
:id
)
# rubocop: disable CodeReuse/ActiveRecord
quick_action_target
.
labels
.
on_project_boards
(
quick_action_target
.
project_id
).
where
.
not
(
id:
label_id
).
pluck
(
:id
)
# rubocop: disable CodeReuse/ActiveRecord
@updates
[
:add_label_ids
]
=
[
label_id
]
@updates
[
:add_label_ids
]
=
[
label_id
]
message
=
_
(
"Moved issue to %{label} column in the board."
)
%
{
label:
labels_to_reference
(
labels
).
first
}
message
=
_
(
"Moved issue to %{label} column in the board."
)
%
{
label:
labels_to_reference
(
labels
).
first
}
else
message
=
_
(
'Move this issue failed because you need to specify only one label.'
)
end
end
@execution_message
[
:board_move
]
=
message
@execution_message
[
:board_move
]
=
message
...
@@ -93,7 +92,7 @@ module Gitlab
...
@@ -93,7 +92,7 @@ module Gitlab
message
=
_
(
"Marked this issue as a duplicate of %{duplicate_param}."
)
%
{
duplicate_param:
duplicate_param
}
message
=
_
(
"Marked this issue as a duplicate of %{duplicate_param}."
)
%
{
duplicate_param:
duplicate_param
}
else
else
message
=
_
(
'
Mark as duplicate failed because referenced issue was not found
'
)
message
=
_
(
'
Failed to mark this issue as a duplicate because referenced issue was not found.
'
)
end
end
@execution_message
[
:duplicate
]
=
message
@execution_message
[
:duplicate
]
=
message
...
@@ -117,18 +116,18 @@ module Gitlab
...
@@ -117,18 +116,18 @@ module Gitlab
message
=
_
(
"Moved this issue to %{path_to_project}."
)
%
{
path_to_project:
target_project_path
}
message
=
_
(
"Moved this issue to %{path_to_project}."
)
%
{
path_to_project:
target_project_path
}
else
else
message
=
_
(
"
Move this issue failed because target project doesn't exists
"
)
message
=
_
(
"
Failed to move this issue because target project doesn't exist.
"
)
end
end
@execution_message
[
:move
]
=
message
@execution_message
[
:move
]
=
message
end
end
desc
_
(
'Make issue confidential
.
'
)
desc
_
(
'Make issue confidential'
)
explanation
do
explanation
do
_
(
'Makes this issue confidential'
)
_
(
'Makes this issue confidential
.
'
)
end
end
execution_message
do
execution_message
do
_
(
'Made this issue confidential'
)
_
(
'Made this issue confidential
.
'
)
end
end
types
Issue
types
Issue
condition
do
condition
do
...
@@ -138,19 +137,19 @@ module Gitlab
...
@@ -138,19 +137,19 @@ module Gitlab
@updates
[
:confidential
]
=
true
@updates
[
:confidential
]
=
true
end
end
desc
_
(
'Create a merge request
.
'
)
desc
_
(
'Create a merge request'
)
explanation
do
|
branch_name
=
nil
|
explanation
do
|
branch_name
=
nil
|
if
branch_name
if
branch_name
_
(
"Creates branch '%{branch_name}' and a merge request to resolve this issue"
)
%
{
branch_name:
branch_name
}
_
(
"Creates branch '%{branch_name}' and a merge request to resolve this issue
.
"
)
%
{
branch_name:
branch_name
}
else
else
_
(
'Creates a branch and a merge request to resolve this issue'
)
_
(
'Creates a branch and a merge request to resolve this issue
.
'
)
end
end
end
end
execution_message
do
|
branch_name
=
nil
|
execution_message
do
|
branch_name
=
nil
|
if
branch_name
if
branch_name
_
(
"Created branch '%{branch_name}' and a merge request to resolve this issue"
)
%
{
branch_name:
branch_name
}
_
(
"Created branch '%{branch_name}' and a merge request to resolve this issue
.
"
)
%
{
branch_name:
branch_name
}
else
else
_
(
'Created a branch and a merge request to resolve this issue'
)
_
(
'Created a branch and a merge request to resolve this issue
.
'
)
end
end
end
end
params
"<branch name>"
params
"<branch name>"
...
...
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
View file @
7a6ecbcb
...
@@ -24,7 +24,7 @@ module Gitlab
...
@@ -24,7 +24,7 @@ module Gitlab
end
end
command
:assign
do
|
users
|
command
:assign
do
|
users
|
if
users
.
empty?
if
users
.
empty?
@execution_message
[
:assign
]
=
_
(
"
Assign command failed because no user was found
"
)
@execution_message
[
:assign
]
=
_
(
"
Failed to assign a user because no user was found.
"
)
next
next
end
end
...
@@ -211,8 +211,8 @@ module Gitlab
...
@@ -211,8 +211,8 @@ module Gitlab
end
end
desc
_
(
"Lock the discussion"
)
desc
_
(
"Lock the discussion"
)
explanation
_
(
"Locks the discussion"
)
explanation
_
(
"Locks the discussion
.
"
)
execution_message
_
(
"Locked the discussion"
)
execution_message
_
(
"Locked the discussion
.
"
)
types
Issue
,
MergeRequest
types
Issue
,
MergeRequest
condition
do
condition
do
quick_action_target
.
persisted?
&&
quick_action_target
.
persisted?
&&
...
@@ -224,8 +224,8 @@ module Gitlab
...
@@ -224,8 +224,8 @@ module Gitlab
end
end
desc
_
(
"Unlock the discussion"
)
desc
_
(
"Unlock the discussion"
)
explanation
_
(
"Unlocks the discussion"
)
explanation
_
(
"Unlocks the discussion
.
"
)
execution_message
_
(
"Unlocked the discussion"
)
execution_message
_
(
"Unlocked the discussion
.
"
)
types
Issue
,
MergeRequest
types
Issue
,
MergeRequest
condition
do
condition
do
quick_action_target
.
persisted?
&&
quick_action_target
.
persisted?
&&
...
...
locale/gitlab.pot
View file @
7a6ecbcb
...
@@ -675,9 +675,6 @@ msgstr ""
...
@@ -675,9 +675,6 @@ msgstr ""
msgid "Add a task list"
msgid "Add a task list"
msgstr ""
msgstr ""
msgid "Add a todo"
msgstr ""
msgid "Add an SSH key"
msgid "Add an SSH key"
msgstr ""
msgstr ""
...
@@ -753,7 +750,7 @@ msgstr ""
...
@@ -753,7 +750,7 @@ msgstr ""
msgid "Added %{label_references} %{label_text}."
msgid "Added %{label_references} %{label_text}."
msgstr ""
msgstr ""
msgid "Added a
tod
o."
msgid "Added a
To D
o."
msgstr ""
msgstr ""
msgid "Added at"
msgid "Added at"
...
@@ -768,7 +765,7 @@ msgstr ""
...
@@ -768,7 +765,7 @@ msgstr ""
msgid "Adds %{labels} %{label_text}."
msgid "Adds %{labels} %{label_text}."
msgstr ""
msgstr ""
msgid "Adds a
tod
o."
msgid "Adds a
To D
o."
msgstr ""
msgstr ""
msgid "Admin Area"
msgid "Admin Area"
...
@@ -1365,9 +1362,6 @@ msgstr ""
...
@@ -1365,9 +1362,6 @@ msgstr ""
msgid "Assign"
msgid "Assign"
msgstr ""
msgstr ""
msgid "Assign command failed because no user was found"
msgstr ""
msgid "Assign custom color like #FF0000"
msgid "Assign custom color like #FF0000"
msgstr ""
msgstr ""
...
@@ -2968,9 +2962,6 @@ msgstr ""
...
@@ -2968,9 +2962,6 @@ msgstr ""
msgid "Commands applied"
msgid "Commands applied"
msgstr ""
msgstr ""
msgid "Commands did not apply"
msgstr ""
msgid "Comment"
msgid "Comment"
msgstr ""
msgstr ""
...
@@ -3396,7 +3387,7 @@ msgstr ""
...
@@ -3396,7 +3387,7 @@ msgstr ""
msgid "Create a GitLab account first, and then connect it to your %{label} account."
msgid "Create a GitLab account first, and then connect it to your %{label} account."
msgstr ""
msgstr ""
msgid "Create a merge request
.
"
msgid "Create a merge request"
msgstr ""
msgstr ""
msgid "Create a new branch"
msgid "Create a new branch"
...
@@ -3504,10 +3495,10 @@ msgstr ""
...
@@ -3504,10 +3495,10 @@ msgstr ""
msgid "Created At"
msgid "Created At"
msgstr ""
msgstr ""
msgid "Created a branch and a merge request to resolve this issue"
msgid "Created a branch and a merge request to resolve this issue
.
"
msgstr ""
msgstr ""
msgid "Created branch '%{branch_name}' and a merge request to resolve this issue"
msgid "Created branch '%{branch_name}' and a merge request to resolve this issue
.
"
msgstr ""
msgstr ""
msgid "Created by me"
msgid "Created by me"
...
@@ -3519,10 +3510,10 @@ msgstr ""
...
@@ -3519,10 +3510,10 @@ msgstr ""
msgid "Created on:"
msgid "Created on:"
msgstr ""
msgstr ""
msgid "Creates a branch and a merge request to resolve this issue"
msgid "Creates a branch and a merge request to resolve this issue
.
"
msgstr ""
msgstr ""
msgid "Creates branch '%{branch_name}' and a merge request to resolve this issue"
msgid "Creates branch '%{branch_name}' and a merge request to resolve this issue
.
"
msgstr ""
msgstr ""
msgid "Creating graphs uses the data from the Prometheus server. If this takes a long time, ensure that data is available."
msgid "Creating graphs uses the data from the Prometheus server. If this takes a long time, ensure that data is available."
...
@@ -4799,6 +4790,12 @@ msgstr ""
...
@@ -4799,6 +4790,12 @@ msgstr ""
msgid "Failed create wiki"
msgid "Failed create wiki"
msgstr ""
msgstr ""
msgid "Failed to apply commands."
msgstr ""
msgid "Failed to assign a user because no user was found."
msgstr ""
msgid "Failed to change the owner"
msgid "Failed to change the owner"
msgstr ""
msgstr ""
...
@@ -4841,6 +4838,18 @@ msgstr ""
...
@@ -4841,6 +4838,18 @@ msgstr ""
msgid "Failed to load related branches"
msgid "Failed to load related branches"
msgstr ""
msgstr ""
msgid "Failed to mark this issue as a duplicate because referenced issue was not found."
msgstr ""
msgid "Failed to move this issue because label was not found."
msgstr ""
msgid "Failed to move this issue because only a single label can be provided."
msgstr ""
msgid "Failed to move this issue because target project doesn't exist."
msgstr ""
msgid "Failed to promote label due to internal error. Please contact administrators."
msgid "Failed to promote label due to internal error. Please contact administrators."
msgstr ""
msgstr ""
...
@@ -6562,13 +6571,13 @@ msgstr ""
...
@@ -6562,13 +6571,13 @@ msgstr ""
msgid "Locked by %{fileLockUserName}"
msgid "Locked by %{fileLockUserName}"
msgstr ""
msgstr ""
msgid "Locked the discussion"
msgid "Locked the discussion
.
"
msgstr ""
msgstr ""
msgid "Locked to current projects"
msgid "Locked to current projects"
msgstr ""
msgstr ""
msgid "Locks the discussion"
msgid "Locks the discussion
.
"
msgstr ""
msgstr ""
msgid "Logo was successfully removed."
msgid "Logo was successfully removed."
...
@@ -6586,13 +6595,13 @@ msgstr ""
...
@@ -6586,13 +6595,13 @@ msgstr ""
msgid "MRDiff|Show full file"
msgid "MRDiff|Show full file"
msgstr ""
msgstr ""
msgid "Made this issue confidential"
msgid "Made this issue confidential
.
"
msgstr ""
msgstr ""
msgid "Make and review changes in the browser with the Web IDE"
msgid "Make and review changes in the browser with the Web IDE"
msgstr ""
msgstr ""
msgid "Make issue confidential
.
"
msgid "Make issue confidential"
msgstr ""
msgstr ""
msgid "Make sure you save it - you won't be able to access it again."
msgid "Make sure you save it - you won't be able to access it again."
...
@@ -6601,7 +6610,7 @@ msgstr ""
...
@@ -6601,7 +6610,7 @@ msgstr ""
msgid "Make sure you're logged into the account that owns the projects you'd like to import."
msgid "Make sure you're logged into the account that owns the projects you'd like to import."
msgstr ""
msgstr ""
msgid "Makes this issue confidential"
msgid "Makes this issue confidential
.
"
msgstr ""
msgstr ""
msgid "Manage"
msgid "Manage"
...
@@ -6667,10 +6676,10 @@ msgstr ""
...
@@ -6667,10 +6676,10 @@ msgstr ""
msgid "March"
msgid "March"
msgstr ""
msgstr ""
msgid "Mark as done"
msgid "Mark
To Do
as done"
msgstr ""
msgstr ""
msgid "Mark as d
uplicate failed because referenced issue was not found
"
msgid "Mark as d
one
"
msgstr ""
msgstr ""
msgid "Mark as resolved"
msgid "Mark as resolved"
...
@@ -6682,9 +6691,6 @@ msgstr ""
...
@@ -6682,9 +6691,6 @@ msgstr ""
msgid "Mark this issue as a duplicate of another issue"
msgid "Mark this issue as a duplicate of another issue"
msgstr ""
msgstr ""
msgid "Mark to do as done"
msgstr ""
msgid "Markdown"
msgid "Markdown"
msgstr ""
msgstr ""
...
@@ -6697,13 +6703,16 @@ msgstr ""
...
@@ -6697,13 +6703,16 @@ msgstr ""
msgid "Markdown is supported"
msgid "Markdown is supported"
msgstr ""
msgstr ""
msgid "Marked To Do as done."
msgstr ""
msgid "Marked this %{noun} as Work In Progress."
msgid "Marked this %{noun} as Work In Progress."
msgstr ""
msgstr ""
msgid "Marked this issue as a duplicate of %{duplicate_param}."
msgid "Marked this issue as a duplicate of %{duplicate_param}."
msgstr ""
msgstr ""
msgid "Mark
ed to d
o as done."
msgid "Mark
s To D
o as done."
msgstr ""
msgstr ""
msgid "Marks this %{noun} as Work In Progress."
msgid "Marks this %{noun} as Work In Progress."
...
@@ -6712,9 +6721,6 @@ msgstr ""
...
@@ -6712,9 +6721,6 @@ msgstr ""
msgid "Marks this issue as a duplicate of %{duplicate_reference}."
msgid "Marks this issue as a duplicate of %{duplicate_reference}."
msgstr ""
msgstr ""
msgid "Marks to do as done."
msgstr ""
msgid "Max access level"
msgid "Max access level"
msgstr ""
msgstr ""
...
@@ -7081,12 +7087,6 @@ msgstr ""
...
@@ -7081,12 +7087,6 @@ msgstr ""
msgid "Move selection up"
msgid "Move selection up"
msgstr ""
msgstr ""
msgid "Move this issue failed because target project doesn't exists"
msgstr ""
msgid "Move this issue failed because you need to specify only one label."
msgstr ""
msgid "Move this issue to another project."
msgid "Move this issue to another project."
msgstr ""
msgstr ""
...
@@ -12188,10 +12188,10 @@ msgstr ""
...
@@ -12188,10 +12188,10 @@ msgstr ""
msgid "Unlocked"
msgid "Unlocked"
msgstr ""
msgstr ""
msgid "Unlocked the discussion"
msgid "Unlocked the discussion
.
"
msgstr ""
msgstr ""
msgid "Unlocks the discussion"
msgid "Unlocks the discussion
.
"
msgstr ""
msgstr ""
msgid "Unmarked this %{noun} as Work In Progress."
msgid "Unmarked this %{noun} as Work In Progress."
...
...
spec/services/quick_actions/interpret_service_spec.rb
View file @
7a6ecbcb
...
@@ -226,7 +226,7 @@ describe QuickActions::InterpretService do
...
@@ -226,7 +226,7 @@ describe QuickActions::InterpretService do
it
'returns the todo message'
do
it
'returns the todo message'
do
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
expect
(
message
).
to
eq
(
'Added a
tod
o.'
)
expect
(
message
).
to
eq
(
'Added a
To D
o.'
)
end
end
end
end
...
@@ -242,7 +242,7 @@ describe QuickActions::InterpretService do
...
@@ -242,7 +242,7 @@ describe QuickActions::InterpretService do
TodoService
.
new
.
mark_todo
(
issuable
,
developer
)
TodoService
.
new
.
mark_todo
(
issuable
,
developer
)
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
expect
(
message
).
to
eq
(
'Marked
to d
o as done.'
)
expect
(
message
).
to
eq
(
'Marked
To D
o as done.'
)
end
end
end
end
...
@@ -453,7 +453,7 @@ describe QuickActions::InterpretService do
...
@@ -453,7 +453,7 @@ describe QuickActions::InterpretService do
it
'returns the lock discussion message'
do
it
'returns the lock discussion message'
do
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
expect
(
message
).
to
eq
(
'Locked the discussion'
)
expect
(
message
).
to
eq
(
'Locked the discussion
.
'
)
end
end
end
end
...
@@ -470,7 +470,7 @@ describe QuickActions::InterpretService do
...
@@ -470,7 +470,7 @@ describe QuickActions::InterpretService do
it
'returns the unlock discussion message'
do
it
'returns the unlock discussion message'
do
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
expect
(
message
).
to
eq
(
'Unlocked the discussion'
)
expect
(
message
).
to
eq
(
'Unlocked the discussion
.
'
)
end
end
end
end
...
@@ -570,7 +570,7 @@ describe QuickActions::InterpretService do
...
@@ -570,7 +570,7 @@ describe QuickActions::InterpretService do
it
'returns move issue failure message when the referenced issue is not found'
do
it
'returns move issue failure message when the referenced issue is not found'
do
_
,
_
,
message
=
service
.
execute
(
'/move invalid'
,
issue
)
_
,
_
,
message
=
service
.
execute
(
'/move invalid'
,
issue
)
expect
(
message
).
to
eq
(
"
Move this issue failed because target project doesn't exists
"
)
expect
(
message
).
to
eq
(
"
Failed to move this issue because target project doesn't exist.
"
)
end
end
end
end
...
@@ -584,7 +584,7 @@ describe QuickActions::InterpretService do
...
@@ -584,7 +584,7 @@ describe QuickActions::InterpretService do
it
'returns the confidential message'
do
it
'returns the confidential message'
do
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
expect
(
message
).
to
eq
(
'Made this issue confidential'
)
expect
(
message
).
to
eq
(
'Made this issue confidential
.
'
)
end
end
end
end
...
@@ -783,7 +783,7 @@ describe QuickActions::InterpretService do
...
@@ -783,7 +783,7 @@ describe QuickActions::InterpretService do
end
end
end
end
it_behaves_like
'empty command'
,
"
Assign command failed because no user was found
"
do
it_behaves_like
'empty command'
,
"
Failed to assign a user because no user was found.
"
do
let
(
:content
)
{
'/assign @abcd1234'
}
let
(
:content
)
{
'/assign @abcd1234'
}
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
end
end
...
@@ -1217,12 +1217,12 @@ describe QuickActions::InterpretService do
...
@@ -1217,12 +1217,12 @@ describe QuickActions::InterpretService do
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
end
end
it_behaves_like
'empty command'
,
'
Mark as duplicate failed because referenced issue was not found
'
do
it_behaves_like
'empty command'
,
'
Failed to mark this issue as a duplicate because referenced issue was not found.
'
do
let
(
:content
)
{
"/duplicate imaginary#1234"
}
let
(
:content
)
{
"/duplicate imaginary#1234"
}
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
end
end
it_behaves_like
'empty command'
,
'
Mark as duplicate failed because referenced issue was not found
'
do
it_behaves_like
'empty command'
,
'
Failed to mark this issue as a duplicate because referenced issue was not found.
'
do
let
(
:other_project
)
{
create
(
:project
,
:private
)
}
let
(
:other_project
)
{
create
(
:project
,
:private
)
}
let
(
:issue_duplicate
)
{
create
(
:issue
,
project:
other_project
)
}
let
(
:issue_duplicate
)
{
create
(
:issue
,
project:
other_project
)
}
...
@@ -1287,7 +1287,7 @@ describe QuickActions::InterpretService do
...
@@ -1287,7 +1287,7 @@ describe QuickActions::InterpretService do
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
end
end
it_behaves_like
'empty command'
,
'
Mark as duplicate failed because referenced issue was not found
'
do
it_behaves_like
'empty command'
,
'
Failed to mark this issue as a duplicate because referenced issue was not found.
'
do
let
(
:content
)
{
'/duplicate #{issue.to_reference}'
}
let
(
:content
)
{
'/duplicate #{issue.to_reference}'
}
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
end
end
...
@@ -1463,19 +1463,19 @@ describe QuickActions::InterpretService do
...
@@ -1463,19 +1463,19 @@ describe QuickActions::InterpretService do
context
'if the given label does not exist'
do
context
'if the given label does not exist'
do
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
let
(
:content
)
{
'/board_move ~"Fake Label"'
}
let
(
:content
)
{
'/board_move ~"Fake Label"'
}
it_behaves_like
'empty command'
,
'
Move this issue failed because you need to specify only one label
.'
it_behaves_like
'empty command'
,
'
Failed to move this issue because label was not found
.'
end
end
context
'if multiple labels are given'
do
context
'if multiple labels are given'
do
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
let
(
:content
)
{
%{/board_move ~"#{inreview.title}" ~"#{todo.title}"}
}
let
(
:content
)
{
%{/board_move ~"#{inreview.title}" ~"#{todo.title}"}
}
it_behaves_like
'empty command'
,
'
Move this issue failed because you need to specify only one label
.'
it_behaves_like
'empty command'
,
'
Failed to move this issue because only a single label can be provided
.'
end
end
context
'if the given label is not a list on the board'
do
context
'if the given label is not a list on the board'
do
let
(
:issuable
)
{
issue
}
let
(
:issuable
)
{
issue
}
let
(
:content
)
{
%{/board_move ~"#{bug.title}"}
}
let
(
:content
)
{
%{/board_move ~"#{bug.title}"}
}
it_behaves_like
'empty command'
it_behaves_like
'empty command'
,
'Failed to move this issue because label was not found.'
end
end
context
'if issuable is not an Issue'
do
context
'if issuable is not an Issue'
do
...
@@ -1552,7 +1552,7 @@ describe QuickActions::InterpretService do
...
@@ -1552,7 +1552,7 @@ describe QuickActions::InterpretService do
it
'returns the create_merge_request message'
do
it
'returns the create_merge_request message'
do
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
_
,
_
,
message
=
service
.
execute
(
content
,
issuable
)
expect
(
message
).
to
eq
(
"Created branch '
#{
branch_name
}
' and a merge request to resolve this issue"
)
expect
(
message
).
to
eq
(
"Created branch '
#{
branch_name
}
' and a merge request to resolve this issue
.
"
)
end
end
end
end
end
end
...
@@ -1814,13 +1814,13 @@ describe QuickActions::InterpretService do
...
@@ -1814,13 +1814,13 @@ describe QuickActions::InterpretService do
it
'uses the default branch name'
do
it
'uses the default branch name'
do
_
,
explanations
=
service
.
explain
(
content
,
issue
)
_
,
explanations
=
service
.
explain
(
content
,
issue
)
expect
(
explanations
).
to
eq
([
'Creates a branch and a merge request to resolve this issue'
])
expect
(
explanations
).
to
eq
([
'Creates a branch and a merge request to resolve this issue
.
'
])
end
end
it
'returns the execution message using the default branch name'
do
it
'returns the execution message using the default branch name'
do
_
,
_
,
message
=
service
.
execute
(
content
,
issue
)
_
,
_
,
message
=
service
.
execute
(
content
,
issue
)
expect
(
message
).
to
eq
(
'Created a branch and a merge request to resolve this issue'
)
expect
(
message
).
to
eq
(
'Created a branch and a merge request to resolve this issue
.
'
)
end
end
end
end
...
@@ -1830,13 +1830,13 @@ describe QuickActions::InterpretService do
...
@@ -1830,13 +1830,13 @@ describe QuickActions::InterpretService do
it
'uses the given branch name'
do
it
'uses the given branch name'
do
_
,
explanations
=
service
.
explain
(
content
,
issue
)
_
,
explanations
=
service
.
explain
(
content
,
issue
)
expect
(
explanations
).
to
eq
([
"Creates branch 'foo' and a merge request to resolve this issue"
])
expect
(
explanations
).
to
eq
([
"Creates branch 'foo' and a merge request to resolve this issue
.
"
])
end
end
it
'returns the execution message using the given branch name'
do
it
'returns the execution message using the given branch name'
do
_
,
_
,
message
=
service
.
execute
(
content
,
issue
)
_
,
_
,
message
=
service
.
execute
(
content
,
issue
)
expect
(
message
).
to
eq
(
"Created branch 'foo' and a merge request to resolve this issue"
)
expect
(
message
).
to
eq
(
"Created branch 'foo' and a merge request to resolve this issue
.
"
)
end
end
end
end
end
end
...
...
spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb
View file @
7a6ecbcb
...
@@ -40,7 +40,7 @@ shared_examples 'move quick action' do
...
@@ -40,7 +40,7 @@ shared_examples 'move quick action' do
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_content
"
Move this issue failed because target project doesn't exists
"
expect
(
page
).
to
have_content
"
Failed to move this issue because target project doesn't exist.
"
expect
(
issue
.
reload
).
to
be_open
expect
(
issue
.
reload
).
to
be_open
end
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