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
07c3778a
Commit
07c3778a
authored
Sep 28, 2018
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add checks to InterpretService conditions
parent
e8e1a51a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
app/services/quick_actions/interpret_service.rb
app/services/quick_actions/interpret_service.rb
+13
-6
No files found.
app/services/quick_actions/interpret_service.rb
View file @
07c3778a
...
@@ -210,8 +210,13 @@ module QuickActions
...
@@ -210,8 +210,13 @@ module QuickActions
end
end
params
'~label1 ~"label 2"'
params
'~label1 ~"label 2"'
condition
do
condition
do
available_labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
project
.
id
,
include_ancestor_groups:
true
).
execute
if
project
available_labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
project
.
id
,
include_ancestor_groups:
true
)
.
execute
end
project
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
&&
available_labels
.
any?
available_labels
.
any?
end
end
...
@@ -286,6 +291,7 @@ module QuickActions
...
@@ -286,6 +291,7 @@ module QuickActions
end
end
params
'#issue | !merge_request'
params
'#issue | !merge_request'
condition
do
condition
do
[
MergeRequest
,
Issue
].
include?
(
issuable
.
class
)
&&
current_user
.
can?
(
:"update_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
current_user
.
can?
(
:"update_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
end
end
parse_params
do
|
issuable_param
|
parse_params
do
|
issuable_param
|
...
@@ -443,6 +449,7 @@ module QuickActions
...
@@ -443,6 +449,7 @@ module QuickActions
end
end
params
'<time(1h30m | -1h30m)> <date(YYYY-MM-DD)>'
params
'<time(1h30m | -1h30m)> <date(YYYY-MM-DD)>'
condition
do
condition
do
issuable
.
is_a?
(
TimeTrackable
)
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
end
end
parse_params
do
|
raw_time_date
|
parse_params
do
|
raw_time_date
|
...
@@ -493,7 +500,7 @@ module QuickActions
...
@@ -493,7 +500,7 @@ module QuickActions
desc
"Lock the discussion"
desc
"Lock the discussion"
explanation
"Locks the discussion"
explanation
"Locks the discussion"
condition
do
condition
do
issuable
.
is_a?
(
Issuable
)
&&
[
MergeRequest
,
Issue
].
include?
(
issuable
.
class
)
&&
issuable
.
persisted?
&&
issuable
.
persisted?
&&
!
issuable
.
discussion_locked?
&&
!
issuable
.
discussion_locked?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
...
@@ -505,7 +512,7 @@ module QuickActions
...
@@ -505,7 +512,7 @@ module QuickActions
desc
"Unlock the discussion"
desc
"Unlock the discussion"
explanation
"Unlocks the discussion"
explanation
"Unlocks the discussion"
condition
do
condition
do
issuable
.
is_a?
(
Issuable
)
&&
[
MergeRequest
,
Issue
].
include?
(
issuable
.
class
)
&&
issuable
.
persisted?
&&
issuable
.
persisted?
&&
issuable
.
discussion_locked?
&&
issuable
.
discussion_locked?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
...
...
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