summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 11:31:08 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:28 -0200
commit355389d065216739a2b8e8150a1a569c410f4ff6 (patch)
tree109be64911e0b99f220a2cee530ab3d05f15129c /app/helpers
parentaa78148901cd3877936bc2afcea9c329077bf951 (diff)
downloadgitlab-ce-355389d065216739a2b8e8150a1a569c410f4ff6.tar.gz
Disable subscribing to group-level labels
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/labels_helper.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index d7cfd24c918..221a84b042f 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -68,11 +68,12 @@ module LabelsHelper
end
end
- def toggle_subscription_label_path(label)
- case label
- when GroupLabel then toggle_subscription_group_label_path(label.group, label)
- when ProjectLabel then toggle_subscription_namespace_project_label_path(label.project.namespace, label.project, label)
- end
+ def toggle_subscription_data(label)
+ return unless label.is_a?(ProjectLabel)
+
+ {
+ url: toggle_subscription_namespace_project_label_path(label.project.namespace, label.project, label)
+ }
end
def render_colored_label(label, label_suffix = '', tooltip: true)
@@ -148,11 +149,17 @@ module LabelsHelper
end
def label_subscription_status(label)
- label.subscribed?(current_user) ? 'subscribed' : 'unsubscribed'
+ case label
+ when GroupLabel then 'Subscribing to group labels is currently not supported.'
+ when ProjectLabel then label.subscribed?(current_user) ? 'subscribed' : 'unsubscribed'
+ end
end
def label_subscription_toggle_button_text(label)
- label.subscribed?(current_user) ? 'Unsubscribe' : 'Subscribe'
+ case label
+ when GroupLabel then 'Subscribing to group labels is currently not supported.'
+ when ProjectLabel then label.subscribed?(current_user) ? 'Unsubscribe' : 'Subscribe'
+ end
end
def label_deletion_confirm_text(label)