Commit 7c831be0 authored by Phil Hughes's avatar Phil Hughes

Updated permission check

Changed how it checks if issuable has weight
parent db7ee8ae
...@@ -317,10 +317,10 @@ module SlashCommands ...@@ -317,10 +317,10 @@ module SlashCommands
end end
desc 'Set weight' desc 'Set weight'
params '1-9' params Issue::WEIGHT_RANGE.to_s.squeeze('.').tr('.', '-')
condition do condition do
issuable.is_a?(Issue) && issuable.respond_to?(:weight) &&
current_user.can?(:"update_#{issuable.to_ability_name}", issuable) current_user.can?(:"admin_#{issuable.to_ability_name}", issuable)
end end
command :weight do |weight| command :weight do |weight|
if Issue.weight_filter_options.include?(weight.to_i) if Issue.weight_filter_options.include?(weight.to_i)
...@@ -331,9 +331,9 @@ module SlashCommands ...@@ -331,9 +331,9 @@ module SlashCommands
desc 'Clear weight' desc 'Clear weight'
condition do condition do
issuable.persisted? && issuable.persisted? &&
issuable.is_a?(Issue) && issuable.respond_to?(:weight) &&
issuable.weight? && issuable.weight? &&
current_user.can?(:"update_#{issuable.to_ability_name}", issuable) current_user.can?(:"admin_#{issuable.to_ability_name}", issuable)
end end
command :clear_weight do command :clear_weight do
@updates[:weight] = nil @updates[:weight] = nil
......
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