diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/services/labels/find_or_create_service.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/labels/find_or_create_service.rb b/app/services/labels/find_or_create_service.rb index 079f611b3f3..a72da3c637f 100644 --- a/app/services/labels/find_or_create_service.rb +++ b/app/services/labels/find_or_create_service.rb @@ -20,6 +20,7 @@ module Labels @available_labels ||= LabelsFinder.new( current_user, "#{parent_type}_id".to_sym => parent.id, + include_ancestor_groups: include_ancestor_groups?, only_group_labels: parent_is_group? ).execute(skip_authorization: skip_authorization) end @@ -30,7 +31,8 @@ module Labels new_label = available_labels.find_by(title: title) if new_label.nil? && (skip_authorization || Ability.allowed?(current_user, :admin_label, parent)) - new_label = Labels::CreateService.new(params).execute(parent_type.to_sym => parent) + create_params = params.except(:include_ancestor_groups) + new_label = Labels::CreateService.new(create_params).execute(parent_type.to_sym => parent) end new_label @@ -47,5 +49,9 @@ module Labels def parent_is_group? parent_type == "group" end + + def include_ancestor_groups? + params[:include_ancestor_groups] == true + end end end |