From 61a72bc2e22548e7c216cf4499ced0841ff521cf Mon Sep 17 00:00:00 2001 From: mk Date: Thu, 6 Mar 2014 14:08:40 +0100 Subject: [PATCH 1/2] Allow underscore as the first char for project names. Not sure if the default_regex really has to be expanded for this special use case. We tried to extend only the project_name_regex first, but that didn't help. --- lib/gitlab/regex.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index d18fc8bf2c..e932b64f4f 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -7,7 +7,7 @@ module Gitlab end def project_name_regex - /\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/ + /\A[a-zA-Z0-9_][a-zA-Z0-9_\-\. ]*\z/ end def name_regex @@ -49,7 +49,7 @@ module Gitlab protected def default_regex - /\A[.?]?[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(? Date: Sun, 9 Mar 2014 23:28:49 -0400 Subject: [PATCH 2/2] Fixes a bug with group member administration Group owners were not able to remove any users from their group if they were the only owner. --- app/models/ability.rb | 1 + features/group.feature | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index 69ada753d0..1afe8a4638 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -240,6 +240,7 @@ class Ability can_manage = group_abilities(user, group).include?(:manage_group) if can_manage && (user != target_user) rules << :modify + rules << :destroy end if !group.last_owner?(user) && (can_manage || (user == target_user)) rules << :destroy diff --git a/features/group.feature b/features/group.feature index 71282fb75b..4e11bcba93 100644 --- a/features/group.feature +++ b/features/group.feature @@ -74,7 +74,7 @@ Feature: Groups When I visit group "Owned" members page Then I should see user "John Doe" in team list Then I should see user "Mary Jane" in team list - Then I should not see the "Remove User From Group" button for "Mary Jane" + Then I should not see the "Remove User From Group" button for "John Doe" @javascript Scenario: Guest should be able to remove himself from group