diff options
-rw-r--r-- | app/helpers/groups_helper.rb | 8 | ||||
-rw-r--r-- | spec/helpers/groups_helper_spec.rb | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index f865cd133ad..f7e6eb350cd 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -104,6 +104,12 @@ module GroupsHelper link_to ancestor.name, group_path(ancestor) end + def remove_the_share_lock_from_ancestor_link(group) + ancestor = oldest_consecutively_locked_ancestor(group) + link_text = s_("GroupSettings|remove the share lock from %{ancestor_group_name}") % { ancestor_group_name: ancestor.name } + link_to link_text, edit_group_path(ancestor) + end + def oldest_consecutively_locked_ancestor(group) group.ancestors.find do |group| !group.has_parent? || !group.parent.share_with_group_lock? @@ -115,7 +121,7 @@ module GroupsHelper end def ancestor_locked_but_you_can_override(group) - s_("GroupSettings|This setting is applied on %{ancestor_group}. You can override the setting or remove the share lock from %{ancestor_group}.") % { ancestor_group: ancestor_group_link(group) } + s_("GroupSettings|This setting is applied on %{ancestor_group}. You can override the setting or %{remove_ancestor_share_lock}.") % { ancestor_group: ancestor_group_link(group), remove_ancestor_share_lock: remove_the_share_lock_from_ancestor_link(group) } end def ancestor_locked_so_ask_the_owner(group) diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb index baa4584f61d..edfa3d9ae5a 100644 --- a/spec/helpers/groups_helper_spec.rb +++ b/spec/helpers/groups_helper_spec.rb @@ -107,9 +107,9 @@ describe GroupsHelper do let(:possible_help_texts) do { default_help: "This setting will be applied to all subgroups unless overridden by a group owner", - ancestor_locked_but_you_can_override: /This setting is applied on [\w\s<>="\/]+\. You can override the setting or remove the share lock from [\w\s<>="\/]+/, - ancestor_locked_so_ask_the_owner: /This setting is applied on [\w\s<>="\/]+\. To share projects in this group with another group, ask the owner to override the setting or remove the share lock from [\w\s<>="\/]+/, - ancestor_locked_and_has_been_overridden: /This setting is applied on [\w\s<>="\/]+ and has been overridden on this subgroup/ + ancestor_locked_but_you_can_override: /This setting is applied on <a .+>.+<\/a>\. You can override the setting or <a .+>remove the share lock from .+<\/a>/, + ancestor_locked_so_ask_the_owner: /This setting is applied on <a .+>.+<\/a>\. To share projects in this group with another group, ask the owner to override the setting or remove the share lock from <a .+>.+<\/a>/, + ancestor_locked_and_has_been_overridden: /This setting is applied on <a .+>.+<\/a> and has been overridden on this subgroup/ } end let(:possible_linked_ancestors) do |