diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/groups_helper.rb | 12 | ||||
-rw-r--r-- | app/views/groups/edit.html.haml | 2 |
2 files changed, 5 insertions, 9 deletions
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index e22e2c2e418..62ad16314bf 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -3,6 +3,10 @@ module GroupsHelper can?(current_user, :change_visibility_level, group) end + def can_change_share_with_group_lock?(group) + can?(current_user, :change_share_with_group_lock, group) + end + def group_icon(group) if group.is_a?(String) group = Group.find_by_full_path(group) @@ -65,14 +69,6 @@ module GroupsHelper { group_name: group.name } end - def share_with_group_lock_disabled - return false unless @group.has_parent? - return false unless @group.parent.share_with_group_lock? - return false unless @group.share_with_group_lock? - return false if @group.has_owner?(current_user) - return true - end - def share_with_group_lock_help_text return default_help unless @group.has_parent? return default_help unless @group.parent.share_with_group_lock? diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index 38d39c29acf..bd8c4b5954a 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -34,7 +34,7 @@ .col-sm-10 .checkbox = f.label :share_with_group_lock do - = f.check_box :share_with_group_lock, disabled: share_with_group_lock_disabled + = f.check_box :share_with_group_lock, disabled: !can_change_share_with_group_lock?(@group) %strong - group_link = link_to @group.name, group_path(@group) = s_("GroupSettings|Prevent sharing a project within %{group} with other groups").html_safe % { group: group_link } |