summaryrefslogtreecommitdiff
path: root/app/helpers/labels_helper.rb
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2019-05-28 10:05:20 +0000
committerLin Jen-Shin <godfat@godfat.org>2019-05-28 10:05:20 +0000
commit4df0e2599bc9bd7c50b6acea02278c1fb97d3ead (patch)
tree9ec579188c4fe083d71da187c64277e3337df22b /app/helpers/labels_helper.rb
parent2d12e22299114490385693a57666d658f0909da7 (diff)
downloadgitlab-ce-4df0e2599bc9bd7c50b6acea02278c1fb97d3ead.tar.gz
Fix display of promote to group label
Since label presenter is used in label index view, label class check doesn't work as expected because the class is now LabelPresenter. Also `label.subject` doesn't work as expected now because Label's model `subject` method is shadowed by Gitlab's presenter's method which uses `subject` for referencing the original object. Instead we use a presenter's method for both checks now. `label_deletion_confirm_text` is not used anywhere so it's removed
Diffstat (limited to 'app/helpers/labels_helper.rb')
-rw-r--r--app/helpers/labels_helper.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 76300e791e6..acc8aeae282 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -5,7 +5,7 @@ module LabelsHelper
include ActionView::Helpers::TagHelper
def show_label_issuables_link?(label, issuables_type, current_user: nil, project: nil)
- return true if label.is_a?(GroupLabel)
+ return true unless label.project_label?
return true unless project
project.feature_available?(issuables_type, current_user)
@@ -159,13 +159,6 @@ module LabelsHelper
label.subscribed?(current_user, project) ? 'Unsubscribe' : 'Subscribe'
end
- def label_deletion_confirm_text(label)
- case label
- when GroupLabel then _('Remove this label? This will affect all projects within the group. Are you sure?')
- when ProjectLabel then _('Remove this label? Are you sure?')
- end
- end
-
def create_label_title(subject)
case subject
when Group
@@ -200,7 +193,7 @@ module LabelsHelper
end
def label_status_tooltip(label, status)
- type = label.is_a?(ProjectLabel) ? 'project' : 'group'
+ type = label.project_label? ? 'project' : 'group'
level = status.unsubscribed? ? type : status.sub('-level', '')
action = status.unsubscribed? ? 'Subscribe' : 'Unsubscribe'