summaryrefslogtreecommitdiff
path: root/app/services/slash_commands
diff options
context:
space:
mode:
authorThomas Balthazar <thomas@balthazar.info>2016-09-08 11:18:41 +0200
committerThomas Balthazar <thomas@balthazar.info>2016-10-03 09:36:21 +0200
commitddbe676dc318b87c3d656a08bbf5d75485ad544b (patch)
treedb8d14ffb9979d8d46772776237e33815848222e /app/services/slash_commands
parentbcb2699f04646e4738bb87410aab49b2c3a686fb (diff)
downloadgitlab-ce-ddbe676dc318b87c3d656a08bbf5d75485ad544b.tar.gz
Add a /wip slash command
It toggles the 'WIP' prefix in the MR title.
Diffstat (limited to 'app/services/slash_commands')
-rw-r--r--app/services/slash_commands/interpret_service.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/services/slash_commands/interpret_service.rb b/app/services/slash_commands/interpret_service.rb
index ffcad5b3a87..1725a30fae5 100644
--- a/app/services/slash_commands/interpret_service.rb
+++ b/app/services/slash_commands/interpret_service.rb
@@ -214,6 +214,18 @@ module SlashCommands
@updates[:due_date] = nil
end
+ desc do
+ "Toggle the Work In Progress status"
+ end
+ condition do
+ issuable.persisted? &&
+ issuable.respond_to?(:work_in_progress?) &&
+ current_user.can?(:"update_#{issuable.to_ability_name}", issuable)
+ end
+ command :wip do
+ @updates[:wip_event] = issuable.work_in_progress? ? 'unwip' : 'wip'
+ end
+
# This is a dummy command, so that it appears in the autocomplete commands
desc 'CC'
params '@user'