Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-11-26 12:12:49 +00:00
parent bc8f298b64
commit 5343536f2b
51 changed files with 290 additions and 253 deletions

View File

@ -2562,7 +2562,6 @@ Style/OpenStructUse:
- 'lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb'
- 'lib/gitlab/testing/request_inspector_middleware.rb'
- 'lib/mattermost/session.rb'
- 'spec/bin/feature_flag_spec.rb'
- 'spec/controllers/admin/clusters_controller_spec.rb'
- 'spec/controllers/groups/clusters_controller_spec.rb'
- 'spec/controllers/import/fogbugz_controller_spec.rb'
@ -2580,8 +2579,6 @@ Style/OpenStructUse:
- 'spec/graphql/mutations/clusters/agents/delete_spec.rb'
- 'spec/graphql/mutations/commits/create_spec.rb'
- 'spec/graphql/mutations/merge_requests/accept_spec.rb'
- 'spec/graphql/mutations/merge_requests/create_spec.rb'
- 'spec/graphql/types/range_input_type_spec.rb'
- 'spec/helpers/application_settings_helper_spec.rb'
- 'spec/helpers/profiles_helper_spec.rb'
- 'spec/initializers/doorkeeper_spec.rb'
@ -2590,7 +2587,6 @@ Style/OpenStructUse:
- 'spec/lib/gitlab/database/migrations/runner_spec.rb'
- 'spec/lib/gitlab/gitaly_client/blobs_stitcher_spec.rb'
- 'spec/lib/gitlab/gitaly_client/diff_stitcher_spec.rb'
- 'spec/lib/gitlab/graphql/pagination/keyset/connection_generic_keyset_spec.rb'
- 'spec/lib/gitlab/graphql/pagination/keyset/connection_spec.rb'
- 'spec/lib/gitlab/legacy_github_import/project_creator_spec.rb'
- 'spec/lib/gitlab/quick_actions/command_definition_spec.rb'

View File

@ -53,6 +53,10 @@ export default {
type: Boolean,
required: true,
},
canPushToBranch: {
type: Boolean,
required: true,
},
emptyRepo: {
type: Boolean,
required: true,
@ -126,6 +130,7 @@ export default {
:target-branch="targetBranch || ref"
:original-branch="originalBranch || ref"
:can-push-code="canPushCode"
:can-push-to-branch="canPushToBranch"
:empty-repo="emptyRepo"
/>
</div>

View File

@ -106,6 +106,7 @@ export default {
ideForkAndEditPath: '',
storedExternally: false,
canModifyBlob: false,
canCurrentUserPushToBranch: false,
rawPath: '',
externalStorageUrl: '',
replacePath: '',
@ -266,6 +267,7 @@ export default {
:replace-path="blobInfo.replacePath"
:delete-path="blobInfo.webPath"
:can-push-code="project.userPermissions.pushCode"
:can-push-to-branch="blobInfo.canCurrentUserPushToBranch"
:empty-repo="project.repository.empty"
:project-path="projectPath"
:is-locked="isLocked"

View File

@ -71,6 +71,10 @@ export default {
type: Boolean,
required: true,
},
canPushToBranch: {
type: Boolean,
required: true,
},
emptyRepo: {
type: Boolean,
required: true,
@ -176,9 +180,12 @@ export default {
</template>
<template v-else>
<input type="hidden" name="original_branch" :value="originalBranch" />
<!-- Once "push to branch" permission is made available, will need to add to conditional
Follow-up issue: https://gitlab.com/gitlab-org/gitlab/-/issues/335462 -->
<input v-if="createNewMr" type="hidden" name="create_merge_request" value="1" />
<input
v-if="createNewMr || !canPushToBranch"
type="hidden"
name="create_merge_request"
value="1"
/>
<gl-form-group
:label="$options.i18n.COMMIT_LABEL"
label-for="commit_message"

View File

@ -28,6 +28,7 @@ query getBlobInfo($projectPath: ID!, $filePath: String!, $ref: String!) {
forkAndEditPath
ideForkAndEditPath
canModifyBlob
canCurrentUserPushToBranch
storedExternally
rawPath
replacePath

View File

@ -12,7 +12,6 @@ module Projects
before_action :define_variables
before_action do
push_frontend_feature_flag(:ajax_new_deploy_token, @project)
push_frontend_feature_flag(:ci_scoped_job_token, @project, default_enabled: :yaml)
end
helper_method :highlight_badge

View File

@ -16,7 +16,7 @@ module Ci
validate_job!(job)
if job.user && Feature.enabled?(:ci_scoped_job_token, job.project, default_enabled: :yaml)
if job.user
job.user.set_ci_job_token_scope!(job)
end
end

View File

@ -91,6 +91,9 @@ module Types
calls_gitaly: true,
description: 'Whether the current user can modify the blob.'
field :can_current_user_push_to_branch, GraphQL::Types::Boolean, null: true, method: :can_current_user_push_to_branch?,
description: 'Whether the current user can push to the branch.'
def raw_text_blob
object.data unless object.binary?
end

View File

@ -94,7 +94,7 @@ class Namespace < ApplicationRecord
validates :max_artifacts_size, numericality: { only_integer: true, greater_than: 0, allow_nil: true }
validate :validate_parent_type, if: -> { Feature.enabled?(:validate_namespace_parent_type, default_enabled: :yaml) }
validate :validate_parent_type
# ProjectNamespaces excluded as they are not meant to appear in the group hierarchy at the moment.
validate :nesting_level_allowed, unless: -> { project_namespace? }

View File

@ -78,6 +78,12 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated
super(blob, project, blob.commit_id)
end
def can_current_user_push_to_branch?
return false unless current_user && project.repository.branch_exists?(blob.commit_id)
user_access(project).can_push_to_branch?(blob.commit_id)
end
def ide_edit_path
super(project, blob.commit_id, blob.path)
end

View File

@ -96,15 +96,14 @@
.settings-content
= render 'ci/deploy_freeze/index'
- if Feature.enabled?(:ci_scoped_job_token, @project, default_enabled: :yaml)
%section.settings.no-animate#js-token-access{ class: ('expanded' if expanded) }
.settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
= _("Token Access")
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _("Control which projects can be accessed by API requests authenticated with this project's CI_JOB_TOKEN CI/CD variable. It is a security risk to disable this feature, because unauthorized projects might attempt to retrieve an active token and access the API.")
= link_to _('Learn more'), help_page_path('ci/jobs/ci_job_token'), target: '_blank', rel: 'noopener noreferrer'
.settings-content
= render 'ci/token_access/index'
%section.settings.no-animate#js-token-access{ class: ('expanded' if expanded) }
.settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
= _("Token Access")
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _("Control which projects can be accessed by API requests authenticated with this project's CI_JOB_TOKEN CI/CD variable. It is a security risk to disable this feature, because unauthorized projects might attempt to retrieve an active token and access the API.")
= link_to _('Learn more'), help_page_path('ci/jobs/ci_job_token'), target: '_blank', rel: 'noopener noreferrer'
.settings-content
= render 'ci/token_access/index'

View File

@ -1,8 +0,0 @@
---
name: ci_scoped_job_token
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62733
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/332272
milestone: '14.0'
type: development
group: group::pipeline execution
default_enabled: true

View File

@ -1,8 +0,0 @@
---
name: keyset_pagination_for_groups_api
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68346
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339831
milestone: '14.3'
type: development
group: group::access
default_enabled: false

View File

@ -1,8 +0,0 @@
---
name: validate_namespace_parent_type
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54094
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/322101
milestone: '13.10'
type: development
group: group::access
default_enabled: true

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class CleanupBackgroundMigrationOfRequirementsToWorkItems < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
MIGRATION = 'MigrateRequirementsToWorkItems'
disable_ddl_transaction!
def up
finalize_background_migration(MIGRATION)
end
def down
# no-op
end
end

View File

@ -0,0 +1 @@
12203afb7b66a12946d971dd601d2ce91e1408fcdf36d9d8b2fadcf09d7c1e56

View File

@ -1160,8 +1160,7 @@ Praefect regularly checks the health of each Gitaly node. This is used to automa
to a newly-elected primary Gitaly node if the current primary node is found to be unhealthy.
We recommend using [repository-specific primary nodes](#repository-specific-primary-nodes). This is
[planned to be the only available election strategy](https://gitlab.com/gitlab-org/gitaly/-/issues/3574)
from GitLab 14.0.
[the only available election strategy](https://gitlab.com/gitlab-org/gitaly/-/issues/3574) from GitLab 14.0.
### Repository-specific primary nodes
@ -1275,7 +1274,7 @@ To migrate existing clusters:
### Deprecated election strategies
WARNING:
The below election strategies are deprecated and are scheduled for removal in GitLab 14.0.
The below election strategies are deprecated and were removed in GitLab 14.0.
Migrate to [repository-specific primary nodes](#repository-specific-primary-nodes).
- **PostgreSQL:** Enabled by default until GitLab 14.0, and equivalent to:

View File

@ -14072,6 +14072,7 @@ Returns [`Tree`](#tree).
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="repositoryblobcancurrentuserpushtobranch"></a>`canCurrentUserPushToBranch` | [`Boolean`](#boolean) | Whether the current user can push to the branch. |
| <a id="repositoryblobcanmodifyblob"></a>`canModifyBlob` | [`Boolean`](#boolean) | Whether the current user can modify the blob. |
| <a id="repositoryblobeditblobpath"></a>`editBlobPath` | [`String`](#string) | Web path to edit the blob in the old-style editor. |
| <a id="repositoryblobexternalstorageurl"></a>`externalStorageUrl` | [`String`](#string) | Web path to download the raw blob via external storage, if enabled. |

View File

@ -61,11 +61,7 @@ tries to steal tokens from other jobs.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/328553) in GitLab 14.1. [Deployed behind the `:ci_scoped_job_token` feature flag](../../user/feature_flags.md), disabled by default.
> - [Enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/332272) in GitLab 14.4.
FLAG:
On self-managed GitLab, by default this feature is available. To hide the feature,
ask an administrator to [disable the `ci_scoped_job_token` flag](../../administration/feature_flags.md).
On GitLab.com, this feature is available.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/332272) in GitLab 14.6.
You can limit the access scope of a project's CI/CD job token to increase the
job token's security. A job token might give extra permissions that aren't necessary

View File

@ -15,10 +15,46 @@ To scale GitLab, the we are
database for CI/CD tables was [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64289)
in GitLab 14.1. This feature is still under development, and is not ready for production use.
### Development setup
By default, GitLab is configured to use only one main database. To
opt-in to use a main database, and CI database, modify the
`config/database.yml` file to have a `main` and a `ci` database
configurations. For example, given a `config/database.yml` like below:
configurations.
You can set this up using [GDK](#gdk-configuration) or by
[manually configuring `config/database.yml`](#manually-set-up-the-cicd-database).
#### GDK configuration
If you are using GDK, you can follow the following steps:
1. On the GDK root directory, run:
```shell
gdk config set gitlab.rails.multiple_databases true
```
1. Open your `gdk.yml`, and confirm that it has the following lines:
```yaml
gitlab:
rails:
multiple_databases: true
```
1. Reconfigure GDK:
```shell
gdk reconfigure
```
1. [Create the new CI/CD database](#create-the-new-database).
#### Manually set up the CI/CD database
You can manually edit `config/database.yml` to split the databases.
To do so, consider a `config/database.yml` file like the example below:
```yaml
development:
@ -44,7 +80,7 @@ test: &test
statement_timeout: 120s
```
Edit the `config/database.yml` to look like this:
Edit it to split the databases into `main` and `ci`:
```yaml
development:
@ -88,6 +124,25 @@ test: &test
statement_timeout: 120s
```
Next, [create the new CI/CD database](#create-the-new-database).
#### Create the new database
After configuring GitLab for the two databases, create the new CI/CD database:
1. Create the new `ci:` database, load the DB schema into the `ci:` database,
and run any pending migrations:
```shell
bundle exec rails rails db:create db:schema:load:ci db:migrate
```
1. Restart GDK:
```shell
gdk restart
```
<!--
NOTE: The `validate_cross_joins!` method in `spec/support/database/prevent_cross_joins.rb` references
the following heading in the code, so if you make a change to this heading, make sure to update

View File

@ -12,20 +12,21 @@ to confirm that a real user, not a bot, is attempting to create an account.
## Configuration
To use reCAPTCHA, first you must create a site and private key.
To use reCAPTCHA, first create a site and private key.
1. Go to the [Google reCAPTCHA page](https://www.google.com/recaptcha/admin).
1. Fill out the form necessary to obtain reCAPTCHA v2 keys.
1. Log in to your GitLab server, with administrator credentials.
1. Go to Reporting Applications Settings in the Admin Area (`admin/application_settings/reporting`).
1. Expand the **Spam and Anti-bot Protection** section.
1. Fill all reCAPTCHA fields with keys from previous steps.
1. To get reCAPTCHA v2 keys, fill in the form and select **Submit**.
1. Sign in to your GitLab server as an administrator.
1. On the top bar, select **Menu > Admin**.
1. On the left sidebar, select **Settings > Reporting** (`admin/application_settings/reporting`).
1. Expand **Spam and Anti-bot Protection**.
1. In the reCAPTCHA fields, enter the keys you obtained in the previous steps.
1. Select the **Enable reCAPTCHA** checkbox.
1. To enable reCAPTCHA for logins via password, select the **Enable reCAPTCHA for login** checkbox.
1. Save the configuration.
1. Change the first line of the `#execute` method in `app/services/spam/spam_verdict_service.rb`
to `return CONDITIONAL_ALLOW` so that the spam check short-circuits and triggers the response to
return `recaptcha_html`.
1. Select **Save changes**.
1. To short-circuit the spam check and trigger the response to return `recaptcha_html`:
1. Open `app/services/spam/spam_verdict_service.rb`.
1. Change the first line of the `#execute` method to `return CONDITIONAL_ALLOW`.
NOTE:
Make sure you are viewing an issuable in a project that is public. If you're working with an issue, the issue is public.

View File

@ -26,6 +26,9 @@ Planning features everyone needs to use day-to-day.
Get work done as a team.
- [Comments and threads](../user/discussions/index.md)
- [Customer relations (CRM)](../user/crm/index.md)
- [Contacts](../user/crm/index.md#contacts)
- [Organizations](../user/crm/index.md#organizations)
- [Issues](../user/project/issues/index.md)
- [Iterations](../user/group/iterations/index.md)
- [Labels](../user/project/labels.md)

View File

@ -1348,27 +1348,6 @@ The DAST tool always emits a JSON report file called `gl-dast-report.json` and
sample reports can be found in the
[DAST repository](https://gitlab.com/gitlab-org/security-products/dast/-/tree/master/test/end-to-end/expect).
### Other formats
Reports can also be generated in Markdown, HTML, and XML. These can be published as artifacts using the following configuration:
```yaml
include:
template: DAST.gitlab-ci.yml
dast:
variables:
DAST_HTML_REPORT: report.html
DAST_MARKDOWN_REPORT: report.md
DAST_XML_REPORT: report.xml
artifacts:
paths:
- $DAST_HTML_REPORT
- $DAST_MARKDOWN_REPORT
- $DAST_XML_REPORT
- gl-dast-report.json
```
## Optimizing DAST
By default, DAST downloads all artifacts defined by previous jobs in the pipeline. If

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

77
doc/user/crm/index.md Normal file
View File

@ -0,0 +1,77 @@
---
stage: Plan
group: Product Planning
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Customer relations management (CRM) **(FREE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/2256) in GitLab 14.6 [with a flag](../../administration/feature_flags.md) named `customer_relations`. Disabled by default.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available,
ask an administrator to [enable the feature flag](../../administration/feature_flags.md) named `customer_relations`.
On GitLab.com, this feature is not available.
You should not use this feature for production environments.
With customer relations management (CRM) you can create a record of contacts
(individuals) and organizations (companies) and relate them to issues.
You can use contacts and organizations to tie work to customers for billing and reporting purposes.
To read more about what is planned for the future, see [issue 2256](https://gitlab.com/gitlab-org/gitlab/-/issues/2256).
## Contacts
To view a group's contacts:
1. On the top bar, select **Menu > Groups** and find your group.
1. On the left sidebar, select **Customer relations > Contacts**.
![Contacts list](crm_contacts_v14_6.png)
You can only [create](../../api/graphql/reference/index.md#mutationcustomerrelationscontactcreate)
or [update](../../api/graphql/reference/index.md#mutationcustomerrelationscontactupdate)
contacts using the GraphQL API.
## Organizations
To view a group's organizations:
1. On the top bar, select **Menu > Groups** and find your group.
1. On the left sidebar, select **Customer relations > Organizations**.
![Organizations list](crm_organizations_v14_6.png)
You can only [create](../../api/graphql/reference/index.md#mutationcustomerrelationsorganizationcreate)
or [update](../../api/graphql/reference/index.md#mutationcustomerrelationsorganizationupdate)
organizations using the GraphQL API.
## Issues
### View issue contacts
You can view contacts associated with an issue in the right sidebar.
To view a contact's details, hover over the contact's name.
![Issue contacts](issue_crm_contacts_v14_6.png)
You can also view issue contacts using the
[GraphQL](../../api/graphql/reference/index.md#mutationcustomerrelationsorganizationcreate)
API.
### Add or remove issue contacts
Prerequisites:
- You must have at least the [Developer role](../permissions.md#project-members-permissions) for a group.
To add contacts to an issue use the `/add_contacts`
[quick action](../project/quick_actions.md).
To remove contacts from an issue use the `/remove_contacts`
[quick action](../project/quick_actions.md).
You can also add, remove, or replace issue contacts using the
[GraphQL](../../api/graphql/reference/index.md#mutationissuesetcrmcontacts)
API.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -805,13 +805,5 @@ the following checks when creating or updating namespaces or groups:
- Namespaces must not have parents.
- Group parents must be groups and not namespaces.
You can disable the validation if GitLab shows the following errors:
- `A user namespace cannot have a parent`.
- `A group cannot have a user namespace as its parent`.
To disable the validation,
[disable the `validate_namespace_parent_type` flag](../../administration/feature_flags.md).
In the unlikely event that you had to disable this feature flag to prevent errors,
In the unlikely event that you see these errors in your GitLab installation,
[contact Support](https://about.gitlab.com/support/) so that we can improve this validation.

View File

@ -7,14 +7,10 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Iterations **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214713) in GitLab 13.1.
> - Deployed behind a feature flag, disabled by default.
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/221047) in GitLab 13.2.
> - Enabled on GitLab.com.
> - Can be enabled or disabled per-group.
> - Recommended for production use.
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-iterations).
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214713) in GitLab 13.1 [with a flag](../../../administration/feature_flags.md) named `group_iterations`. Disabled by default.
> - [Enabled on self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/221047) in GitLab 13.2.
> - Moved to GitLab Premium in 13.9.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/221047) in GitLab 14.6. [Feature flag `group_iterations`](https://gitlab.com/gitlab-org/gitlab/-/issues/221047) removed.
Iterations are a way to track issues over a period of time. This allows teams
to track velocity and volatility metrics. Iterations can be used with [milestones](../../project/milestones/index.md)
@ -171,30 +167,6 @@ To group issues by label:
You can also search for labels by typing in the search input.
1. Select or tap outside of the label dropdown. The page is now grouped by the selected labels.
## Enable or disable iterations **(PREMIUM SELF)**
GitLab Iterations feature is deployed with a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can disable it for your instance. `:group_iterations` can be enabled or disabled per-group.
To enable it:
```ruby
# Instance-wide
Feature.enable(:group_iterations)
# or by group
Feature.enable(:group_iterations, Group.find(<group ID>))
```
To disable it:
```ruby
# Instance-wide
Feature.disable(:group_iterations)
# or by group
Feature.disable(:group_iterations, Group.find(<group ID>))
```
### Enable or disable iteration cadences **(PREMIUM SELF)**
Iteration Cadences feature is under development and not ready for production use. It is

View File

@ -35,7 +35,7 @@ If you manually enter a parameter, it must be enclosed in double quotation marks
- ASCII letters
- Numbers (0-9)
- Underscore (`_`), hyphen (`-`), question mark (`?`), dot (`.`), or ampersand (`&`)
- Underscore (`_`), hyphen (`-`), question mark (`?`), dot (`.`), ampersand (`&`) or at (`@`)
Parameters are case-sensitive. Autocomplete handles this, and the insertion
of quotation marks, automatically.
@ -45,14 +45,15 @@ of quotation marks, automatically.
The following quick actions are applicable to descriptions, discussions, and
threads. Some quick actions might not be available to all subscription tiers.
<!-- Keep this table sorted alphabetically -->
| Command | Issue | Merge request | Epic | Action |
|:--------------------------------------|:-----------------------|:-----------------------|:-----------------------|:-------|
| `/add_contacts email1 email2` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Add one or more [CRM contacts](../crm/index.md) ([introduced in GitLab 14.6](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73413)). |
| `/approve` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Approve the merge request. |
| `/assign @user` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Assign one user. |
| `/assign @user1 @user2` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Assign multiple users. |
| `/assign @user1 @user2` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Assign one or more users. |
| `/assign me` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Assign yourself. |
| `/assign_reviewer @user` or `/reviewer @user` or `/request_review @user` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Assign one user as a reviewer. |
| `/assign_reviewer @user1 @user2` or `/reviewer @user1 @user2` or `/request_review @user1 @user2` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Assign multiple users as reviewers. |
| `/assign_reviewer @user1 @user2` or `/reviewer @user1 @user2` or `/request_review @user1 @user2` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Assign one or more users as reviewers. |
| `/assign_reviewer me` or `/reviewer me` or `/request_review me` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Assign yourself as a reviewer. |
| `/award :emoji:` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Toggle emoji award. |
| `/child_epic <epic>` | **{dotted-circle}** No | **{dotted-circle}** No | **{check-circle}** Yes | Add child epic to `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic ([introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/-/issues/7330)). |
@ -81,11 +82,12 @@ threads. Some quick actions might not be available to all subscription tiers.
| `/promote_to_incident` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Promote issue to incident ([introduced in GitLab 14.5](https://gitlab.com/gitlab-org/gitlab/-/issues/296787)). |
| `/publish` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Publish issue to an associated [Status Page](../../operations/incident_management/status_page.md) ([Introduced in GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30906)) |
| `/reassign @user1 @user2` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Replace current assignees with those specified. |
| `/rebase` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Rebase source branch. This schedules a background task that attempts to rebase the changes in the source branch on the latest commit of the target branch. If `/rebase` is used, `/merge` is ignored to avoid a race condition where the source branch is merged or deleted before it is rebased. If there are merge conflicts, GitLab displays a message that a rebase cannot be scheduled. Rebase failures are displayed with the merge request status. |
| `/reassign_reviewer @user1 @user2` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Replace current reviewers with those specified. |
| `/rebase` | **{dotted-circle}** No | **{check-circle}** Yes | **{dotted-circle}** No | Rebase source branch. This schedules a background task that attempts to rebase the changes in the source branch on the latest commit of the target branch. If `/rebase` is used, `/merge` is ignored to avoid a race condition where the source branch is merged or deleted before it is rebased. If there are merge conflicts, GitLab displays a message that a rebase cannot be scheduled. Rebase failures are displayed with the merge request status. |
| `/relabel ~label1 ~label2` | **{check-circle}** Yes | **{check-circle}** Yes | **{check-circle}** Yes | Replace current labels with those specified. |
| `/relate #issue1 #issue2` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Mark issues as related. |
| `/remove_child_epic <epic>` | **{dotted-circle}** No | **{dotted-circle}** No | **{check-circle}** Yes | Remove child epic from `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic ([introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/-/issues/7330)). |
| `/remove_contacts email1 email2` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Remove one or more [CRM contacts](../crm/index.md) ([introduced in GitLab 14.6](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73413)). |
| `/remove_due_date` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Remove due date. |
| `/remove_epic` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Remove from epic. |
| `/remove_estimate` | **{check-circle}** Yes | **{check-circle}** Yes | **{dotted-circle}** No | Remove time estimate. |

View File

@ -109,7 +109,7 @@ module API
end
def present_groups_with_pagination_strategies(params, groups)
return present_groups(params, groups) if current_user.present? || Feature.disabled?(:keyset_pagination_for_groups_api)
return present_groups(params, groups) if current_user.present?
options = {
with: Entities::Group,

View File

@ -40,6 +40,7 @@ module Gitlab
private
def prohibited_branch_checks
return if deletion?
return unless Feature.enabled?(:prohibit_hexadecimal_branch_names, project, default_enabled: true)
if branch_name =~ /\A\h{40}\z/

View File

@ -239,7 +239,7 @@ RSpec.describe 'bin/feature-flag' do
end
describe '.read_rollout_issue_url' do
let(:options) { OpenStruct.new(name: 'foo', type: :development) }
let(:options) { double('options', name: 'foo', type: :development) }
let(:url) { 'https://issue' }
it 'reads type from $stdin' do
@ -265,7 +265,7 @@ RSpec.describe 'bin/feature-flag' do
end
describe '.read_ee_only' do
let(:options) { OpenStruct.new(name: 'foo', type: :development) }
let(:options) { double('options', name: 'foo', type: :development) }
it { expect(described_class.read_ee_only(options)).to eq(false) }
end

View File

@ -1,8 +1,12 @@
# frozen_string_literal: true
FactoryBot.define do
factory :namespace do
# This factory is called :namespace but actually maps (and always has) to User type
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74152#note_730034103 for context
factory :namespace, class: 'Namespaces::UserNamespace' do
sequence(:name) { |n| "namespace#{n}" }
type { Namespaces::UserNamespace.sti_name }
path { name.downcase.gsub(/\s/, '_') }
owner { association(:user, strategy: :build, namespace: instance, username: path) }

View File

@ -14,7 +14,6 @@ RSpec.describe 'Group navbar' do
before do
insert_package_nav(_('Kubernetes'))
stub_feature_flags(group_iterations: false)
stub_feature_flags(customer_relations: false)
stub_config(dependency_proxy: { enabled: false })
stub_config(registry: { enabled: false })

View File

@ -70,17 +70,6 @@ RSpec.describe Ci::AuthJobFinder do
expect(subject.user).to be_from_ci_job_token
expect(subject.user.ci_job_token_scope.source_project).to eq(job.project)
end
context 'when feature flag ci_scoped_job_token is disabled' do
before do
stub_feature_flags(ci_scoped_job_token: false)
end
it 'does not set ci_job_token_scope on the job user' do
expect(subject).to eq(job)
expect(subject.user).not_to be_from_ci_job_token
end
end
end
end
end

View File

@ -9,6 +9,7 @@ const DEFAULT_PROPS = {
name: 'some name',
path: 'some/path',
canPushCode: true,
canPushToBranch: true,
replacePath: 'some/replace/path',
deletePath: 'some/delete/path',
emptyRepo: false,

View File

@ -13,6 +13,7 @@ const initialProps = {
targetBranch: 'some-target-branch',
originalBranch: 'main',
canPushCode: true,
canPushToBranch: true,
emptyRepo: false,
};
@ -103,22 +104,25 @@ describe('DeleteBlobModal', () => {
);
it.each`
input | value | emptyRepo | canPushCode | exist
${'authenticity_token'} | ${'mock-csrf-token'} | ${false} | ${true} | ${true}
${'authenticity_token'} | ${'mock-csrf-token'} | ${true} | ${false} | ${true}
${'_method'} | ${'delete'} | ${false} | ${true} | ${true}
${'_method'} | ${'delete'} | ${true} | ${false} | ${true}
${'original_branch'} | ${initialProps.originalBranch} | ${false} | ${true} | ${true}
${'original_branch'} | ${undefined} | ${true} | ${true} | ${false}
${'create_merge_request'} | ${'1'} | ${false} | ${false} | ${true}
${'create_merge_request'} | ${'1'} | ${false} | ${true} | ${true}
${'create_merge_request'} | ${undefined} | ${true} | ${false} | ${false}
input | value | emptyRepo | canPushCode | canPushToBranch | exist
${'authenticity_token'} | ${'mock-csrf-token'} | ${false} | ${true} | ${true} | ${true}
${'authenticity_token'} | ${'mock-csrf-token'} | ${true} | ${false} | ${true} | ${true}
${'_method'} | ${'delete'} | ${false} | ${true} | ${true} | ${true}
${'_method'} | ${'delete'} | ${true} | ${false} | ${true} | ${true}
${'original_branch'} | ${initialProps.originalBranch} | ${false} | ${true} | ${true} | ${true}
${'original_branch'} | ${undefined} | ${true} | ${true} | ${true} | ${false}
${'create_merge_request'} | ${'1'} | ${false} | ${false} | ${true} | ${true}
${'create_merge_request'} | ${'1'} | ${false} | ${true} | ${true} | ${true}
${'create_merge_request'} | ${'1'} | ${false} | ${false} | ${false} | ${true}
${'create_merge_request'} | ${'1'} | ${false} | ${false} | ${true} | ${true}
${'create_merge_request'} | ${undefined} | ${true} | ${false} | ${true} | ${false}
`(
'passes $input as a hidden input with the correct value',
({ input, value, emptyRepo, canPushCode, exist }) => {
({ input, value, emptyRepo, canPushCode, canPushToBranch, exist }) => {
createComponent({
emptyRepo,
canPushCode,
canPushToBranch,
});
const inputMethod = findForm().find(`input[name="${input}"]`);

View File

@ -11,6 +11,7 @@ export const simpleViewerMock = {
forkAndEditPath: 'some_file.js/fork/edit',
ideForkAndEditPath: 'some_file.js/fork/ide',
canModifyBlob: true,
canCurrentUserPushToBranch: true,
storedExternally: false,
rawPath: 'some_file.js',
replacePath: 'some_file.js/replace',

View File

@ -7,9 +7,10 @@ RSpec.describe Mutations::MergeRequests::Create do
let_it_be(:project) { create(:project, :public, :repository) }
let_it_be(:user) { create(:user) }
let_it_be(:context) do
let(:context) do
GraphQL::Query::Context.new(
query: OpenStruct.new(schema: nil),
query: double('query', schema: nil),
values: { current_user: user },
object: nil
)

View File

@ -24,7 +24,7 @@ RSpec.describe ::Types::RangeInputType do
it 'follows expected subtyping relationships for instances' do
context = GraphQL::Query::Context.new(
query: OpenStruct.new(schema: nil),
query: double('query', schema: nil),
values: {},
object: nil
)

View File

@ -28,6 +28,7 @@ RSpec.describe Types::Repository::BlobType do
:rich_viewer,
:plain_data,
:can_modify_blob,
:can_current_user_push_to_branch,
:ide_edit_path,
:external_storage_url,
:fork_and_edit_path,

View File

@ -32,6 +32,15 @@ RSpec.describe Gitlab::Checks::BranchCheck do
expect { subject.validate! }.not_to raise_error
end
context "deleting a hexadecimal branch" do
let(:newrev) { "0000000000000000000000000000000000000000" }
let(:ref) { "refs/heads/267208abfe40e546f5e847444276f7d43a39503e" }
it "doesn't prohibit the deletion of a hexadecimal branch name" do
expect { subject.validate! }.not_to raise_error
end
end
context "the feature flag is disabled" do
it "doesn't prohibit a 40-character hexadecimal branch name" do
stub_feature_flags(prohibit_hexadecimal_branch_names: false)

View File

@ -9,7 +9,7 @@ RSpec.describe Gitlab::Graphql::Pagination::Keyset::Connection do
let(:arguments) { {} }
let(:query_type) { GraphQL::ObjectType.new }
let(:schema) { GraphQL::Schema.define(query: query_type, mutation: nil)}
let(:context) { GraphQL::Query::Context.new(query: OpenStruct.new(schema: schema), values: nil, object: nil) }
let(:context) { GraphQL::Query::Context.new(query: double('query', schema: schema), values: nil, object: nil) }
let_it_be(:column_order_id) { Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(attribute_name: 'id', order_expression: Project.arel_table[:id].asc) }
let_it_be(:column_order_id_desc) { Gitlab::Pagination::Keyset::ColumnOrderDefinition.new(attribute_name: 'id', order_expression: Project.arel_table[:id].desc) }

View File

@ -94,34 +94,6 @@ RSpec.describe Group do
expect(group).to be_valid
end
end
context 'when the feature flag `validate_namespace_parent_type` is disabled' do
before do
stub_feature_flags(validate_namespace_parent_type: false)
end
context 'when the group has no parent' do
it 'allows a group to have no parent associated with it' do
group = build(:group)
expect(group).to be_valid
end
end
context 'when the group has a parent' do
it 'allows a group to have a namespace as its parent' do
group = build(:group, parent: build(:namespace))
expect(group).to be_valid
end
it 'allows a group to have another group as its parent' do
group = build(:group, parent: build(:group))
expect(group).to be_valid
end
end
end
end
describe 'path validation' do

View File

@ -21,7 +21,7 @@ RSpec.describe Namespace::TraversalHierarchy, type: :model do
end
context 'with group outside of hierarchy' do
let(:group) { create(:namespace) }
let(:group) { create(:group) }
it { expect(hierarchy.root).not_to eq root }
end

View File

@ -107,34 +107,6 @@ RSpec.describe Namespace do
end
end
end
context 'when the feature flag `validate_namespace_parent_type` is disabled' do
before do
stub_feature_flags(validate_namespace_parent_type: false)
end
context 'when the namespace has no parent' do
it 'allows a namespace to have no parent associated with it' do
namespace = build(:namespace)
expect(namespace).to be_valid
end
end
context 'when the namespace has a parent' do
it 'allows a namespace to have a group as its parent' do
namespace = build(:namespace, parent: build(:group))
expect(namespace).to be_valid
end
it 'allows a namespace to have another namespace as its parent' do
namespace = build(:namespace, parent: build(:namespace))
expect(namespace).to be_valid
end
end
end
end
describe '#nesting_level_allowed' do

View File

@ -31,6 +31,28 @@ RSpec.describe BlobPresenter do
it { expect(presenter.replace_path).to eq("/#{project.full_path}/-/create/#{blob.commit_id}/#{blob.path}") }
end
describe '#can_current_user_push_to_branch' do
let(:branch_exists) { true }
before do
allow(project.repository).to receive(:branch_exists?).with(blob.commit_id).and_return(branch_exists)
end
it { expect(presenter.can_current_user_push_to_branch?).to eq(true) }
context 'current_user is nil' do
let(:user) { nil }
it { expect(presenter.can_current_user_push_to_branch?).to eq(false) }
end
context 'branch does not exist' do
let(:branch_exists) { false }
it { expect(presenter.can_current_user_push_to_branch?).to eq(false) }
end
end
describe '#pipeline_editor_path' do
context 'when blob is .gitlab-ci.yml' do
before do

View File

@ -174,18 +174,6 @@ RSpec.describe API::Groups do
'Remaining records can be retrieved using keyset pagination.'
)
end
context 'when the feature flag `keyset_pagination_for_groups_api` is disabled' do
before do
stub_feature_flags(keyset_pagination_for_groups_api: false)
end
it 'returns successful response' do
get api('/groups'), params: { page: 3000, per_page: 25 }
expect(response).to have_gitlab_http_status(:ok)
end
end
end
context 'on making requests below the allowed offset pagination threshold' do
@ -247,24 +235,6 @@ RSpec.describe API::Groups do
expect(records.size).to eq(1)
expect(records.first['id']).to eq(group_2.id)
end
context 'when the feature flag `keyset_pagination_for_groups_api` is disabled' do
before do
stub_feature_flags(keyset_pagination_for_groups_api: false)
end
it 'ignores the keyset pagination params and performs offset pagination' do
get api('/groups'), params: { pagination: 'keyset', per_page: 1 }
expect(response).to have_gitlab_http_status(:ok)
records = json_response
expect(records.size).to eq(1)
expect(records.first['id']).to eq(group_1.id)
params_for_next_page = params_for_next_page(response)
expect(params_for_next_page).not_to include('cursor')
end
end
end
context 'on making requests with unsupported ordering structure' do

View File

@ -190,7 +190,8 @@ RSpec.shared_context 'group navbar structure' do
[
_('List'),
_('Board'),
_('Milestones')
_('Milestones'),
(_('Iterations') if Gitlab.ee?)
]
end

View File

@ -346,7 +346,8 @@ RSpec.shared_examples 'a pypi user namespace endpoint' do
end
with_them do
let_it_be_with_reload(:group) { create(:namespace) }
# only groups are supported, so this "group" is actually the wrong namespace type
let_it_be_with_reload(:group) { create(:user_namespace) }
let(:headers) { user_role == :anonymous ? {} : basic_auth_header(user.username, personal_access_token.token) }
before do