diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-11-15 21:11:13 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-11-17 15:10:13 -0200 |
commit | d533c0e7287f6e1474163ac3f63b5511e8b12244 (patch) | |
tree | 44f4ac5cbfd5c5d94242f144b92cff10c5d54b42 /app/helpers/labels_helper.rb | |
parent | e2865c232efd4350dd82d0fbdfdf2f226e4e8461 (diff) | |
download | gitlab-ce-d533c0e7287f6e1474163ac3f63b5511e8b12244.tar.gz |
Avoid code duplication for label subscription status on label partial
Diffstat (limited to 'app/helpers/labels_helper.rb')
-rw-r--r-- | app/helpers/labels_helper.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index 7495414f525..4f180456b16 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -140,7 +140,7 @@ module LabelsHelper end end - def group_label_subscription_status(label, project) + def label_subscription_status(label, project) return 'project-level' if label.subscribed?(current_user, project) return 'group-level' if label.subscribed?(current_user) @@ -148,16 +148,12 @@ module LabelsHelper end def group_label_unsubscribe_path(label, project) - case group_label_subscription_status(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) end end - def label_subscription_status(label, project) - label.subscribed?(current_user, project) ? 'subscribed' : 'unsubscribed' - end - def label_subscription_toggle_button_text(label, project) label.subscribed?(current_user, project) ? 'Unsubscribe' : 'Subscribe' end |