Commit a9b6ecb3 authored by Sean McGivern's avatar Sean McGivern

Merge branch '38022-add-remove_label-quick-action-more-intuitive-than-unlabel' into 'master'

Resolve "Add "remove_label" quick action (more intuitive than "unlabel")"

Closes #38022

See merge request gitlab-org/gitlab!24962
parents 24bb372e 41b67db8
---
title: Define remove_label quick action as alias of unlabel
merge_request: 24962
author: Jacopo Beschi @jacopo-beschi
type: added
......@@ -42,7 +42,7 @@ The following quick actions are applicable to descriptions, discussions and thre
| `/remove_milestone` | ✓ | ✓ | | Remove milestone |
| `/label ~label1 ~label2` | ✓ | ✓ | ✓ | Add label(s). Label names can also start without `~` but mixed syntax is not supported |
| `/relabel ~label1 ~label2` | ✓ | ✓ | ✓ | Replace existing label(s) with those specified |
| `/unlabel ~label1 ~label2` | ✓ | ✓ | ✓ | Remove all or specific label(s) |
| `/unlabel ~label1 ~label2` or `/remove_label ~label1 ~label2` | ✓ | ✓ | ✓ | Remove all or specific label(s) |
| `/copy_metadata <#issue>` | ✓ | ✓ | | Copy labels and milestone from another issue in the project |
| `/copy_metadata <!merge_request>` | ✓ | ✓ | | Copy labels and milestone from another merge request in the project |
| `/estimate <<W>w <DD>d <hh>h <mm>m>` | ✓ | ✓ | | Set time estimate. For example, `/estimate 1w 3d 2h 14m` |
......
......@@ -109,7 +109,7 @@ module Gitlab
quick_action_target.labels.any? &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", parent)
end
command :unlabel do |labels_param = nil|
command :unlabel, :remove_label do |labels_param = nil|
if labels_param.present?
labels = find_labels(labels_param)
label_ids = labels.map(&:id)
......
......@@ -18,6 +18,16 @@ RSpec.shared_examples 'issuable quick actions' do
end
end
let(:unlabel_expectation) do
->(noteable, can_use_quick_action) {
if can_use_quick_action
expect(noteable.labels).to be_empty
else
expect(noteable.labels).not_to be_empty
end
}
end
# Quick actions shared by issues and merge requests
let(:issuable_quick_actions) do
[
......@@ -136,13 +146,11 @@ RSpec.shared_examples 'issuable quick actions' do
),
QuickAction.new(
action_text: "/unlabel",
expectation: ->(noteable, can_use_quick_action) {
if can_use_quick_action
expect(noteable.labels).to be_empty
else
expect(noteable.labels).not_to be_empty
end
}
expectation: unlabel_expectation
),
QuickAction.new(
action_text: "/remove_label",
expectation: unlabel_expectation
),
QuickAction.new(
action_text: "/award :100:",
......
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