Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-09-27 03:10:03 +00:00
parent 077b92f78b
commit 7f31bb5cfd
27 changed files with 192 additions and 40 deletions

View File

@ -18,4 +18,4 @@ variables:
# Retry failed specs in separate process
QA_RETRY_FAILED_SPECS: "true"
# helm chart ref used by test-on-cng pipeline
GITLAB_HELM_CHART_REF: "b2e14fd2722528e664401e736e0e1edd0f4a6f69"
GITLAB_HELM_CHART_REF: "e05a64634ee53ca6868c47c6081e0f3a686e41f1"

View File

@ -29,6 +29,7 @@ const PERSISTENT_USER_CALLOUTS = [
'.js-all-seats-used',
'.js-period-in-terraform-state-name-alert',
'.js-expired-duo-pro-trial-widget',
'.js-duo-free-access-ending-banner',
];
const initCallouts = () => {

View File

@ -77,11 +77,6 @@
.timeline-entry:not(.draft-note):last-child::before {
@apply gl-bg-default;
// stylelint-disable-next-line gitlab/no-gl-class
.gl-dark & {
@apply gl-bg-subtle;
}
// stylelint-disable-next-line gitlab/no-gl-class
.gl-dark .modal-body & {
@apply gl-bg-strong;

View File

@ -14,17 +14,26 @@ module Resolvers
required: false,
description: 'Return only projects where current user has at least the specified access level.'
argument :include_personal, GraphQL::Types::Boolean,
description: 'Include personal projects.',
required: false,
default_value: false
alias_method :user, :object
def resolve(**args)
ContributedProjectsFinder.new(
contributed_projects = ContributedProjectsFinder.new(
user: user,
current_user: current_user,
params: {
order_by: args[:sort],
min_access_level: args[:min_access_level]
}
).execute.joined(user)
).execute
return contributed_projects if args[:include_personal]
contributed_projects.joined(user)
end
end
end

View File

@ -93,7 +93,8 @@ module Users
period_in_terraform_state_name_alert: 91,
work_item_epic_feedback: 92, # EE-only
branch_rules_tip_callout: 93,
openssl_callout: 94
openssl_callout: 94,
duo_free_access_ending_banner: 95 # EE-only
}
validates :feature_name,

View File

@ -21,6 +21,8 @@
= render_if_exists 'gitlab_subscriptions/trials/alert', namespace: @group
= render_if_exists 'shared/duo_free_access_ending_banner', resource: @group
= render 'groups/home_panel'
= render_if_exists 'groups/group_activity_analytics', group: @group

View File

@ -3,6 +3,7 @@
- @skip_current_level_breadcrumb = true
= render_if_exists 'projects/duo_free_access_ending_banner', project: @project
= render partial: 'flash_messages', locals: { project: @project }
= render 'clusters_deprecation_alert'

View File

@ -7,6 +7,7 @@
= auto_discovery_link_tag(:atom, project_path(@project, rss_url_options), title: "#{@project.name} activity")
= render_if_exists 'shared/promotions/promote_mobile_devops', project: @project
= render_if_exists 'projects/duo_free_access_ending_banner', project: @project
= render partial: 'flash_messages', locals: { project: @project }
= render 'clusters_deprecation_alert'

View File

@ -1,8 +1,9 @@
---
migration_job_name: BackfillAgentActivityEventsAgentProjectId
description: Backfills sharding key `agent_activity_events.agent_project_id` from `cluster_agents`.
description: Backfills sharding key `agent_activity_events.agent_project_id` from
`cluster_agents`.
feature_category: deployment_management
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154615
milestone: '17.1'
queued_migration_version: 20240529184616
finalized_by: # version of the migration that finalized this BBM
finalized_by: '20240926231943'

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class AddMigrateMembershipsToBulkImportConfigurations < Gitlab::Database::Migration[2.2]
milestone '17.5'
def change
add_column :bulk_import_configurations, :migrate_memberships, :boolean, default: true, null: false
end
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
class RemoveFaultyAsyncIndexDefinitions < Gitlab::Database::Migration[2.2]
milestone '17.5'
def up
unprepare_async_index_by_name :merge_request_diff_commits_b5377a7a34,
:index_merge_request_diff_commits_b5377a7a34_on_project_id
unprepare_async_index_by_name :merge_request_diff_files_99208b8fac,
:index_merge_request_diff_files_99208b8fac_on_project_id
end
def down
# no-op
end
end

View File

@ -0,0 +1,21 @@
# frozen_string_literal: true
class FinalizeBackfillAgentActivityEventsAgentProjectId < Gitlab::Database::Migration[2.2]
milestone '17.5'
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main_cell
def up
ensure_batched_background_migration_is_finished(
job_class_name: 'BackfillAgentActivityEventsAgentProjectId',
table_name: :agent_activity_events,
column_name: :id,
job_arguments: [:agent_project_id, :cluster_agents, :project_id, :agent_id],
finalize: true
)
end
def down; end
end

View File

@ -0,0 +1 @@
7388e13f70524cc140a13602d7dde566e213ac16773ee66b776c065c29489e33

View File

@ -0,0 +1 @@
dca955fb2f25ca3e40cdf2a4fe195a27bc53a1134eb172ecbe6b436fdc888ca0

View File

@ -0,0 +1 @@
0c7ed8e3faa3001929f69f884ca08614190e86040794b2320b79c0469fe412e7

View File

@ -7572,7 +7572,8 @@ CREATE TABLE bulk_import_configurations (
encrypted_access_token text,
encrypted_access_token_iv text,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL
updated_at timestamp with time zone NOT NULL,
migrate_memberships boolean DEFAULT true NOT NULL
);
CREATE SEQUENCE bulk_import_configurations_id_seq

View File

@ -17369,6 +17369,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="addonusercontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="addonusercontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="addonusercontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |
@ -18257,6 +18258,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="autocompletedusercontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="autocompletedusercontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="autocompletedusercontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |
@ -20649,6 +20651,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="currentusercontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="currentusercontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="currentusercontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |
@ -26221,6 +26224,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="mergerequestassigneecontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="mergerequestassigneecontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="mergerequestassigneecontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |
@ -26611,6 +26615,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="mergerequestauthorcontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="mergerequestauthorcontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="mergerequestauthorcontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |
@ -27047,6 +27052,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="mergerequestparticipantcontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="mergerequestparticipantcontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="mergerequestparticipantcontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |
@ -27456,6 +27462,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="mergerequestreviewercontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="mergerequestreviewercontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="mergerequestreviewercontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |
@ -33950,6 +33957,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="usercorecontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="usercorecontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="usercorecontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |
@ -38764,6 +38772,7 @@ Name of the feature that the callout is for.
| <a id="usercalloutfeaturenameenumdeployment_approvals_empty_state"></a>`DEPLOYMENT_APPROVALS_EMPTY_STATE` | Callout feature name for deployment_approvals_empty_state. |
| <a id="usercalloutfeaturenameenumdeployment_details_feedback"></a>`DEPLOYMENT_DETAILS_FEEDBACK` | Callout feature name for deployment_details_feedback. |
| <a id="usercalloutfeaturenameenumduo_chat_callout"></a>`DUO_CHAT_CALLOUT` | Callout feature name for duo_chat_callout. |
| <a id="usercalloutfeaturenameenumduo_free_access_ending_banner"></a>`DUO_FREE_ACCESS_ENDING_BANNER` | Callout feature name for duo_free_access_ending_banner. |
| <a id="usercalloutfeaturenameenumfeature_flags_new_version"></a>`FEATURE_FLAGS_NEW_VERSION` | Callout feature name for feature_flags_new_version. |
| <a id="usercalloutfeaturenameenumgcp_signup_offer"></a>`GCP_SIGNUP_OFFER` | Callout feature name for gcp_signup_offer. |
| <a id="usercalloutfeaturenameenumgeo_enable_hashed_storage"></a>`GEO_ENABLE_HASHED_STORAGE` | Callout feature name for geo_enable_hashed_storage. |
@ -41100,6 +41109,7 @@ four standard [pagination arguments](#pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="usercontributedprojectsincludepersonal"></a>`includePersonal` | [`Boolean`](#boolean) | Include personal projects. |
| <a id="usercontributedprojectsminaccesslevel"></a>`minAccessLevel` | [`AccessLevelEnum`](#accesslevelenum) | Return only projects where current user has at least the specified access level. |
| <a id="usercontributedprojectssort"></a>`sort` | [`ProjectSort`](#projectsort) | Sort contributed projects. |

View File

@ -8,7 +8,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
DETAILS:
**Tier:** Free, Premium, Ultimate
**Offering:** GitLab.com, Self-managed, GitLab Dedicated
**Offering:** GitLab.com, Self-managed
**Status:** Beta
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/227345) in GitLab 17.3 [with a flag](../../../administration/feature_flags.md) named `jacoco_coverage_reports`. Disabled by default.

View File

@ -12,11 +12,16 @@ For background of GitLab Cells, refer to the [design document](https://handbook.
Depending on the use case, your feature may be [cell-local or clusterwide](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/#how-do-i-decide-whether-to-move-my-feature-to-the-cluster-cell-or-organization-level) and hence the tables used for the feature should also use the appropriate schema.
When you choose the appropriate schema for tables, consider the following guidelines as part of the [Cells](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/) architecture:
When you choose the appropriate [schema](../database/multiple_databases.md#gitlab-schema) for tables, consider the following guidelines as part of the [Cells](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/) architecture:
- Default to `gitlab_main_cell`: We expect most tables to be assigned to the `gitlab_main_cell` schema by default. Choose this schema if the data in the table is related to `projects` or `namespaces`.
- Consult with the Tenant Scale group: If you believe that the `gitlab_main_clusterwide` schema is more suitable for a table, seek approval from the Tenant Scale group. This is crucial because it has scaling implications and may require reconsideration of the schema choice.
Tables with `gitlab_main_clusterwide` schema will need additional work to be replicated to other / all cells.
The replication strategy will likely be different for each case, but will involve internal APIs.
The application may also need to be modified to restrict writes to prevent conflicts.
We may also ask teams to update tables from `gitlab_main_clusterwide` to `gitlab_main_cell` as required, which also might require adding sharding keys to these tables.
To understand how existing tables are classified, you can use [this dashboard](https://manojmj.gitlab.io/tenant-scale-schema-progress/).
After a schema has been assigned, the merge request pipeline might fail due to one or more of the following reasons, which can be rectified by following the linked guidelines:

View File

@ -32,7 +32,7 @@ This should enable everyone to see locally any change in an IDE being sent to th
1. Main Application (GDK):
1. Install the [GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/index.md#one-line-installation).
1. Enable Feature Flag ```ai_duo_code_suggestions_switch```:
1. Enable Feature Flag `ai_duo_code_suggestions_switch`:
1. In your terminal, go to your `gitlab-development-kit` > `gitlab` directory.
1. Run `gdk rails console` or `bundle exec rails c` to start a Rails console.
1. [Enable the Feature Flag](../../administration/feature_flags.md#enable-or-disable-the-feature) for the Code Suggestions tokens API by calling `Feature.enable(:ai_duo_code_suggestions_switch)` from the console.
@ -63,7 +63,7 @@ with the deployed staging AI Gateway. To do this:
1. Add a **GitLab Ultimate Self-Managed** subscription with a [Duo Pro subscription add-on](../../subscriptions/subscription-add-ons.md) to your GDK instance.
1. Sign in to the [staging Customers Portal](https://customers.staging.gitlab.com) by selecting the **Continue with GitLab.com account** button.
If you do not have an existing account, you are prompted to create one.
If you do not have an existing account, you are prompted to create one.
1. If you do not have an existing cloud activation code, visit the **Ultimate Self-Managed Subscription** page using the [buy subscription flow link](https://gitlab.com/gitlab-org/customers-gitlab-com/-/blob/8aa922840091ad5c5d96ada43d0065a1b6198841/doc/flows/buy_subscription.md).
1. Purchase the subscription using [a test credit card](https://gitlab.com/gitlab-org/customers-gitlab-com/#testing-credit-card-information).
1. Once you have a subscription, on the subscription card, select the ellipse menu **...** > **Buy Duo Pro add-on**.
@ -81,13 +81,13 @@ with the deployed staging AI Gateway. To do this:
export GITLAB_SIMULATE_SAAS=0
```
On a non-GDK instance, you can set the variables using `gitlab_rails['env']` in the `gitlab.rb` file:
On a non-GDK instance, you can set the variables using `gitlab_rails['env']` in the `gitlab.rb` file:
```shell
gitlab_rails['env'] = {
'GITLAB_LICENSE_MODE' => 'test',
'CUSTOMER_PORTAL_URL' => 'https://customers.staging.gitlab.com',
'AI_GATEWAY_URL' => 'https://cloud.staging.gitlab.com/ai'
'GITLAB_LICENSE_MODE' => 'test',
'CUSTOMER_PORTAL_URL' => 'https://customers.staging.gitlab.com',
'AI_GATEWAY_URL' => 'https://cloud.staging.gitlab.com/ai'
}
```
@ -97,19 +97,19 @@ with the deployed staging AI Gateway. To do this:
1. Add the new activation code.
1. Inside your GDK, navigate to **Admin area** > **GitLab Duo Pro**, go to `/admin/code_suggestions`
1. Filter users to find `root` and click the toggle to assign a GitLab Duo Pro add-on seat to the root user
1. Filter users to find `root` and click the toggle to assign a GitLab Duo Pro add-on seat to the root user.
### Setup instructions to use the Duo Pro add-on with a **staging** GitLab.com account
1. Have your account ready at <https://staging.gitlab.com>
1. [Create a new group](../../user/group/index.md#create-a-group) or use an existing one as the namespace which will receive the Duo Pro access
1. Navigate to `Settings > Billing`
1. Initiate the purchase flow for the Ultimate plan by clicking on `Upgrade to Ultimate`
1. After being redirected to <https://customers.staging.gitlab.com>, click on `Continue with your Gitlab.com account`
1. Purchase the SaaS Ultimate subscription using [a test credit card](https://gitlab.com/gitlab-org/customers-gitlab-com#testing-credit-card-information)
1. Find the newly purchased subscription card, and select from the three dots menu the option `Buy GitLab Duo Pro`
1. Purchase the GitLab Duo Pro add-on using the same test credit card from the above steps
1. Go back to <https://staging.gitlab.com> and verify that your group has access to Duo Pro by navigating to `Settings > GitLab Duo` and managing seats
1. Have your account ready at <https://staging.gitlab.com>.
1. [Create a new group](../../user/group/index.md#create-a-group) or use an existing one as the namespace which will receive the Duo Pro access.
1. Navigate to `Settings > Billing`.
1. Initiate the purchase flow for the Ultimate plan by clicking on `Upgrade to Ultimate`.
1. After being redirected to <https://customers.staging.gitlab.com>, click on `Continue with your Gitlab.com account`.
1. Purchase the SaaS Ultimate subscription using [a test credit card](https://gitlab.com/gitlab-org/customers-gitlab-com#testing-credit-card-information).
1. Find the newly purchased subscription card, and select from the three dots menu the option `Buy GitLab Duo Pro`.
1. Purchase the GitLab Duo Pro add-on using the same test credit card from the above steps.
1. Go back to <https://staging.gitlab.com> and verify that your group has access to Duo Pro by navigating to `Settings > GitLab Duo` and managing seats.
### Video demonstrations of installing and using Code Suggestions in IDEs

View File

@ -351,8 +351,7 @@ module Gitlab
end
types MergeRequest
condition do
quick_action_target.persisted? &&
reviewers_to_remove?(@updates) &&
reviewers_to_remove?(@updates) &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", project)
end
parse_params do |unassign_reviewer_param|
@ -360,12 +359,24 @@ module Gitlab
extract_users(unassign_reviewer_param) if quick_action_target.allows_multiple_reviewers?
end
command :unassign_reviewer, :remove_reviewer do |users = nil|
current_reviewers = quick_action_target.reviewers
# if preceding commands have been executed already, we need to use the updated reviewer_ids
current_reviewers = User.find(@updates[:reviewer_ids]) if @updates[:reviewer_ids].present?
if quick_action_target.allows_multiple_reviewers? && users&.any?
@updates[:reviewer_ids] ||= quick_action_target.reviewers.map(&:id)
@updates[:reviewer_ids] -= users.map(&:id)
else
@updates[:reviewer_ids] = []
end
removed_reviewers = current_reviewers.select { |user| @updates[:reviewer_ids].exclude?(user.id) }
# only generate the message here if the change would not be traceable otherwise
# because all reviewers have been assigned and removed immediately
if removed_reviewers.present? && !reviewers_to_remove?(@updates)
@execution_message[:unassign_reviewer] = _("Removed %{reviewer_text} %{reviewer_references}.") %
{ reviewer_text: 'reviewer'.pluralize(removed_reviewers.size), reviewer_references: removed_reviewers.map(&:to_reference).to_sentence }
end
end
end

View File

@ -20213,6 +20213,18 @@ msgstr ""
msgid "DuoEnterpriseTrial|We just need some additional information to activate your trial."
msgstr ""
msgid "DuoFreeAccessEndingBanner|Buy Duo Pro"
msgstr ""
msgid "DuoFreeAccessEndingBanner|Dismiss Free Access Ending banner"
msgstr ""
msgid "DuoFreeAccessEndingBanner|Free access to GitLab Duo is ending on %{date}"
msgstr ""
msgid "DuoFreeAccessEndingBanner|Starting %{date}, all GitLab Duo features, including Duo Chat, %{link_start}require a paid add-on subscription.%{link_end} To ensure uninterrupted access to Code Suggestions and Chat, buy Duo Pro and assign seats to your users. Or, for Duo Enterprise options, contact Sales."
msgstr ""
msgid "DuoProDiscover|Accelerate your path to market"
msgstr ""

View File

@ -279,7 +279,7 @@
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-local-rules": "^3.0.2",
"eslint-plugin-no-jquery": "2.7.0",
"eslint-plugin-no-unsanitized": "^4.1.0",
"eslint-plugin-no-unsanitized": "^4.1.1",
"fake-indexeddb": "^4.0.1",
"gettext-extractor": "^3.7.0",
"gettext-extractor-vue": "^5.1.0",

View File

@ -33,8 +33,7 @@ RSpec.describe 'cross-database foreign keys' do
'protected_branch_merge_access_levels.user_id', # https://gitlab.com/gitlab-org/gitlab/-/issues/431055
'user_group_callouts.user_id', # https://gitlab.com/gitlab-org/gitlab/-/issues/421287
'subscription_user_add_on_assignments.user_id', # https://gitlab.com/gitlab-org/gitlab/-/issues/444666
'subscription_add_on_purchases.subscription_add_on_id', # https://gitlab.com/gitlab-org/gitlab/-/issues/444666
'dast_pre_scan_verifications.dast_profile_id' # https://gitlab.com/gitlab-org/gitlab/-/issues/479141
'subscription_add_on_purchases.subscription_add_on_id' # https://gitlab.com/gitlab-org/gitlab/-/issues/444666
]
end

View File

@ -9,22 +9,25 @@ RSpec.describe 'Getting contributedProjects of the user', feature_category: :gro
let(:user_params) { { username: user.username } }
let(:user_fields) { 'contributedProjects { nodes { id } }' }
let_it_be(:user) { create(:user) }
let_it_be(:user) { create(:user, :with_namespace) }
let_it_be(:current_user) { create(:user) }
let_it_be(:public_project) { create(:project, :public) }
let_it_be(:private_project) { create(:project, :private) }
let_it_be(:internal_project) { create(:project, :internal) }
let_it_be(:personal_project) { create(:project, namespace: user.namespace) }
let(:path) { %i[user contributed_projects nodes] }
before_all do
private_project.add_developer(user)
private_project.add_developer(current_user)
personal_project.add_developer(current_user)
travel_to(4.hours.from_now) { create(:push_event, project: private_project, author: user) }
travel_to(3.hours.from_now) { create(:push_event, project: internal_project, author: user) }
travel_to(2.hours.from_now) { create(:push_event, project: public_project, author: user) }
travel_to(2.hours.from_now) { create(:push_event, project: personal_project, author: user) }
end
it_behaves_like 'a working graphql query' do
@ -410,6 +413,37 @@ RSpec.describe 'Getting contributedProjects of the user', feature_category: :gro
end
end
context 'when include_personal argument is false' do
it 'does not include personal projects' do
post_graphql(query, current_user: current_user)
expect(graphql_data_at(*path))
.to contain_exactly(
a_graphql_entity_for(private_project),
a_graphql_entity_for(internal_project),
a_graphql_entity_for(public_project)
)
end
end
context 'when include_personal argument is true' do
let(:query_with_include_personal) do
graphql_query_for(:user, user_params, 'contributedProjects(includePersonal: true) { nodes { id } }')
end
it 'includes personal projects' do
post_graphql(query_with_include_personal, current_user: current_user)
expect(graphql_data_at(*path))
.to contain_exactly(
a_graphql_entity_for(private_project),
a_graphql_entity_for(internal_project),
a_graphql_entity_for(public_project),
a_graphql_entity_for(personal_project)
)
end
end
describe 'sorting and pagination' do
let(:data_path) { [:user, :contributed_projects] }

View File

@ -1200,6 +1200,26 @@ RSpec.describe QuickActions::InterpretService, feature_category: :team_planning
it_behaves_like 'failed command', 'Could not apply unassign_reviewer command.'
end
context 'with a not-yet-persisted merge request and a preceding assign_reviewer command' do
let(:content) do
<<-QUICKACTION
/assign_reviewer #{developer.to_reference}
/unassign_reviewer #{developer.to_reference}
QUICKACTION
end
let(:issuable) { build(:merge_request) }
it 'adds and then removes a single reviewer in a single step' do
_, updates, message = service.execute(content, issuable)
translated_string = _("Assigned %{developer_to_reference} as reviewer. Removed reviewer %{developer_to_reference}.")
formatted_message = format(translated_string, developer_to_reference: developer.to_reference.to_s)
expect(updates).to eq(reviewer_ids: [])
expect(message).to eq(formatted_message)
end
end
context 'with anything after the command' do
let(:content) { '/unassign_reviewer supercalifragilisticexpialidocious' }

View File

@ -6800,10 +6800,10 @@ eslint-plugin-no-jquery@2.7.0:
resolved "https://registry.yarnpkg.com/eslint-plugin-no-jquery/-/eslint-plugin-no-jquery-2.7.0.tgz#855f5631cf5b8e25b930cf6f06e02dd81f132e72"
integrity sha512-Aeg7dA6GTH1AcWLlBtWNzOU9efK5KpNi7b0EhBO0o0M+awyzguUUo8gF6hXGjQ9n5h8/uRtYv9zOqQkeC5CG0w==
eslint-plugin-no-unsanitized@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.1.0.tgz#2c914e8ea8048c3afaac8f0c12384747aba6497a"
integrity sha512-9A8Yrbkkex8e56ivxJ2f5dXN2Js2BmKC8QgmeYZjadyiGUngo3KLXDlq6ZzalmCHyLwLF5MoQLPR6FWlNc+Qbw==
eslint-plugin-no-unsanitized@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.1.1.tgz#15e638416fcac50c4f1d4d13473cfa339ea163aa"
integrity sha512-N0yf7iYWQAO/qiglZlrASXRf6I/18q9d9NNR5Vw175zgrPduvLfnBwgWwM75D4g4lbrd9uPNXlieaFGWZ40h4A==
eslint-plugin-promise@^7.0.0:
version "7.0.0"