summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-06-26 17:52:14 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-06-26 17:55:52 -0300
commit33b61858a0564d0825bf5fc2e709f806c3282e4f (patch)
tree78b3436b35780c72bac90c0091a92da5f1ddb96f
parente51953bea753ccb209d2d6382e9fc24f294b7dae (diff)
downloadgitlab-ce-33b61858a0564d0825bf5fc2e709f806c3282e4f.tar.gz
Fix LabelsHelper#toggle_subscription_label_path
-rw-r--r--app/helpers/labels_helper.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index b2ddcd76b08..6baf6f31d8f 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -145,10 +145,12 @@ module LabelsHelper
end
def toggle_subscription_label_path(label, project)
- if label.is_a?(GroupLabel)
- toggle_subscription_group_label_path(label.group, label)
- else
- toggle_subscription_namespace_project_label_path(project.namespace, project, label)
+ return toggle_subscription_group_label_path(label.group, label) unless project
+
+ case label_subscription_status(label, project)
+ when 'group-level' then toggle_subscription_group_label_path(label.group, label)
+ when 'project-level' then toggle_subscription_namespace_project_label_path(project.namespace, project, label)
+ when 'unsubscribed' then toggle_subscription_namespace_project_label_path(project.namespace, project, label)
end
end