diff --git a/app/models/group.rb b/app/models/group.rb index 8e89c7ecfb1..9520db1bc0a 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -63,6 +63,8 @@ class Group < Namespace after_save :update_two_factor_requirement after_update :path_changed_hook, if: :saved_change_to_path? + scope :with_users, -> { includes(:users) } + class << self def sort_by_attribute(method) if method == 'storage_size_desc' diff --git a/doc/user/project/code_owners.md b/doc/user/project/code_owners.md index ae04616943f..c76847616b3 100644 --- a/doc/user/project/code_owners.md +++ b/doc/user/project/code_owners.md @@ -1,10 +1,12 @@ # Code Owners **[STARTER]** -> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6916) +> - [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6916) in [GitLab Starter](https://about.gitlab.com/pricing/) 11.3. +> - [Support for group namespaces](https://gitlab.com/gitlab-org/gitlab-ce/issues/53182) added in GitLab Starter 12.1. -You can use a `CODEOWNERS` file to specify users that are responsible -for certain files in a repository. +You can use a `CODEOWNERS` file to specify users or +[shared groups](members/share_project_with_groups.md) +that are responsible for certain files in a repository. You can choose and add the `CODEOWNERS` file in three places: @@ -25,7 +27,8 @@ the given file. Files can be specified using the same kind of patterns you would use in the `.gitignore` file followed by the `@username` or email of one -or more users that should be owners of the file. +or more users or by the `@name` of one or more groups that should +be owners of the file. The order in which the paths are defined is significant: the last pattern that matches a given path will be used to find the code @@ -63,6 +66,10 @@ CODEOWNERS @multiple @owners @tab-separated # owner for the LICENSE file LICENSE @legal this_does_not_match janedoe@gitlab.com +# Group names can be used to match groups and nested groups to specify +# them as owners for a file +README @group @group/with-nested/subgroup + # Ending a path in a `/` will specify the code owners for every file # nested in that directory, on any level /docs/ @all-docs diff --git a/lib/gitlab/user_extractor.rb b/lib/gitlab/user_extractor.rb deleted file mode 100644 index ede60c9ab1d..00000000000 --- a/lib/gitlab/user_extractor.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# This class extracts all users found in a piece of text by the username or the -# email address - -module Gitlab - class UserExtractor - # Not using `Devise.email_regexp` to filter out any chars that an email - # does not end with and not pinning the email to a start of end of a string. - EMAIL_REGEXP = /(?([^@\s]+@[^@\s]+(?