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
476d146e
Commit
476d146e
authored
Feb 17, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added weight slash command
Closes #852
parent
506fbc04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
app/services/slash_commands/interpret_service.rb
app/services/slash_commands/interpret_service.rb
+24
-0
changelogs/unreleased-ee/weight-slash-command.yml
changelogs/unreleased-ee/weight-slash-command.yml
+4
-0
No files found.
app/services/slash_commands/interpret_service.rb
View file @
476d146e
...
...
@@ -316,6 +316,30 @@ module SlashCommands
@updates
[
:target_branch
]
=
branch_name
if
project
.
repository
.
branch_names
.
include?
(
branch_name
)
end
desc
'Set weight'
params
'1-9'
condition
do
issuable
.
persisted?
&&
issuable
.
is_a?
(
Issue
)
&&
current_user
.
can?
(
:"update_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
end
command
:weight
do
|
weight
|
if
Issue
.
weight_filter_options
.
include?
(
weight
.
to_i
)
@updates
[
:weight
]
=
weight
end
end
desc
'Clear weight'
condition
do
issuable
.
persisted?
&&
issuable
.
is_a?
(
Issue
)
&&
issuable
.
weight?
&&
current_user
.
can?
(
:"update_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
end
command
:clear_weight
do
@updates
[
:weight
]
=
nil
end
def
find_label_ids
(
labels_param
)
label_ids_by_reference
=
extract_references
(
labels_param
,
:label
).
map
(
&
:id
)
labels_ids_by_name
=
LabelsFinder
.
new
(
current_user
,
project_id:
project
.
id
,
name:
labels_param
.
split
).
execute
.
select
(
:id
)
...
...
changelogs/unreleased-ee/weight-slash-command.yml
0 → 100644
View file @
476d146e
---
title
:
Added weight slash command
merge_request
:
author
:
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