diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-06-22 23:11:14 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-06-26 17:55:52 -0300 |
commit | af6c01fb6f94f1e95972f928edcdce7518d3a4a0 (patch) | |
tree | a4c7d370d15ce2eac32f39ffbddbbc0798c92b8c /app/helpers/labels_helper.rb | |
parent | b7ea3ce467534f185961dd2ad6afc2b5f70b7436 (diff) | |
download | gitlab-ce-af6c01fb6f94f1e95972f928edcdce7518d3a4a0.tar.gz |
Allow users to subscribe to group labels on group labels page
Diffstat (limited to 'app/helpers/labels_helper.rb')
-rw-r--r-- | app/helpers/labels_helper.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index 4e6e6805920..6c99d993a5f 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -134,20 +134,21 @@ module LabelsHelper end def label_subscription_status(label, project) - return 'project-level' if label.subscribed?(current_user, project) return 'group-level' if label.subscribed?(current_user) + return 'project-level' if label.subscribed?(current_user, project) 'unsubscribed' end - def group_label_unsubscribe_path(label, project) - case label_subscription_status(label, project) - when 'project-level' then toggle_subscription_namespace_project_label_path(@project.namespace, @project, label) - when 'group-level' then toggle_subscription_group_label_path(label.group, label) + 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) end end - def label_subscription_toggle_button_text(label, project) + def label_subscription_toggle_button_text(label, project = nil) label.subscribed?(current_user, project) ? 'Unsubscribe' : 'Subscribe' end |