diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-02-03 17:36:17 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-02-03 17:36:17 +0000 |
commit | 0dc365914c682965774e475921117f4aee359a9b (patch) | |
tree | e6ad7c273bc558346d2ff3dfc51d1e22c2b56e3e /app/services | |
parent | bd8f2b15b3d5267075a626ce86f3a06cc650fcbf (diff) | |
parent | 9bb08a7e53b22d7af8484e3921b6fe51996ca981 (diff) | |
download | gitlab-ce-0dc365914c682965774e475921117f4aee359a9b.tar.gz |
Merge branch 'Add-a-shash-command-for-target-merge-request-branch' into 'master'
Adds /target_branch slash command functionality for merge requests
Closes #23619
See merge request !7216
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/slash_commands/interpret_service.rb | 12 |
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 3566a8ba92f..3e0a85cf059 100644 --- a/app/services/slash_commands/interpret_service.rb +++ b/app/services/slash_commands/interpret_service.rb @@ -304,6 +304,18 @@ module SlashCommands params '@user' command :cc + desc 'Defines target branch for MR' + params '<Local branch name>' + condition do + issuable.respond_to?(:target_branch) && + (current_user.can?(:"update_#{issuable.to_ability_name}", issuable) || + issuable.new_record?) + end + command :target_branch do |target_branch_param| + branch_name = target_branch_param.strip + @updates[:target_branch] = branch_name if project.repository.branch_names.include?(branch_name) + 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) |