Commit 476d146e authored by Phil Hughes's avatar Phil Hughes

Added weight slash command

Closes #852
parent 506fbc04
......@@ -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)
......
---
title: Added weight slash command
merge_request:
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment