Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/experiments/templates/new_project_readme_content/readme_advanced.md.tt2
-rw-r--r--app/models/clusters/clusters_hierarchy.rb2
-rw-r--r--app/services/suggestions/apply_service.rb2
-rw-r--r--app/services/suggestions/create_service.rb2
-rw-r--r--app/services/wiki_pages/event_create_service.rb6
-rw-r--r--config/metrics/counts_28d/20210816143831_i_code_review_total_suggestions_added_monthly.yml27
-rw-r--r--config/metrics/counts_28d/20210816144453_i_code_review_total_suggestions_applied_monthly.yml27
-rw-r--r--config/metrics/counts_7d/20210816144119_i_code_review_total_suggestions_added_weekly.yml27
-rw-r--r--config/metrics/counts_7d/20210816144247_i_code_review_total_suggestions_applied_weekly.yml27
-rw-r--r--doc/integration/omniauth.md7
-rw-r--r--doc/topics/autodevops/index.md45
-rw-r--r--doc/user/admin_area/moderate_users.md5
-rw-r--r--lib/gitlab/auth/o_auth/user.rb2
-rw-r--r--lib/gitlab/import_export/attributes_permitter.rb8
-rw-r--r--lib/gitlab/import_export/relation_tree_restorer.rb4
-rw-r--r--lib/gitlab/timeless.rb3
-rw-r--r--lib/gitlab/usage_data_counters/known_events/code_review_events.yml8
-rw-r--r--lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb26
-rw-r--r--lib/tasks/gitlab/graphql.rake4
-rwxr-xr-xscripts/used-feature-flags1
-rw-r--r--spec/controllers/omniauth_callbacks_controller_spec.rb4
-rw-r--r--spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb2
-rw-r--r--spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb22
-rw-r--r--spec/migrations/update_minimum_password_length_spec.rb2
-rw-r--r--spec/models/user_spec.rb6
-rw-r--r--spec/services/suggestions/apply_service_spec.rb2
-rw-r--r--spec/services/suggestions/create_service_spec.rb2
-rw-r--r--spec/services/wiki_pages/event_create_service_spec.rb4
28 files changed, 209 insertions, 70 deletions
diff --git a/app/experiments/templates/new_project_readme_content/readme_advanced.md.tt b/app/experiments/templates/new_project_readme_content/readme_advanced.md.tt
index 70a32ba6f03..bbe8271386f 100644
--- a/app/experiments/templates/new_project_readme_content/readme_advanced.md.tt
+++ b/app/experiments/templates/new_project_readme_content/readme_advanced.md.tt
@@ -38,6 +38,8 @@ Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](<%= redirect("https://docs.gitlab.com/ee/ci/quick_start/index.html") %>)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](<%= redirect("https://docs.gitlab.com/ee/user/application_security/sast/") %>)
+- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](<%= redirect("https://docs.gitlab.com/ee/topics/autodevops/requirements.html") %>)
+- [ ] [Use pull-based deployments for improved Kubernetes management](<%= redirect("https://docs.gitlab.com/ee/user/clusters/agent/") %>)
***
diff --git a/app/models/clusters/clusters_hierarchy.rb b/app/models/clusters/clusters_hierarchy.rb
index 162a1a3290d..9435d258d67 100644
--- a/app/models/clusters/clusters_hierarchy.rb
+++ b/app/models/clusters/clusters_hierarchy.rb
@@ -83,7 +83,7 @@ module Clusters
project_id: clusterable.id
}
- model.sanitize_sql_array([Arel.sql(order), values])
+ Arel.sql(model.sanitize_sql_array([Arel.sql(order), values]))
end
def group_clusters_base_query
diff --git a/app/services/suggestions/apply_service.rb b/app/services/suggestions/apply_service.rb
index 6836700a67d..a0d26e08341 100644
--- a/app/services/suggestions/apply_service.rb
+++ b/app/services/suggestions/apply_service.rb
@@ -33,7 +33,7 @@ module Suggestions
.update_all(commit_id: result[:result], applied: true)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter
- .track_apply_suggestion_action(user: current_user)
+ .track_apply_suggestion_action(user: current_user, suggestions: suggestion_set.suggestions)
end
def author
diff --git a/app/services/suggestions/create_service.rb b/app/services/suggestions/create_service.rb
index c5f9fa1eee0..eb98ed57d55 100644
--- a/app/services/suggestions/create_service.rb
+++ b/app/services/suggestions/create_service.rb
@@ -28,7 +28,7 @@ module Suggestions
Gitlab::Database.main.bulk_insert('suggestions', rows) # rubocop:disable Gitlab/BulkInsert
end
- Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_add_suggestion_action(user: @note.author)
+ Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_add_suggestion_action(note: @note)
end
end
end
diff --git a/app/services/wiki_pages/event_create_service.rb b/app/services/wiki_pages/event_create_service.rb
index ebfc2414f9e..1f613bec00e 100644
--- a/app/services/wiki_pages/event_create_service.rb
+++ b/app/services/wiki_pages/event_create_service.rb
@@ -10,11 +10,9 @@ module WikiPages
end
def execute(slug, page, action, event_fingerprint)
- event = Event.transaction do
- wiki_page_meta = WikiPage::Meta.find_or_create(slug, page)
+ wiki_page_meta = WikiPage::Meta.find_or_create(slug, page)
- ::EventCreateService.new.wiki_event(wiki_page_meta, author, action, event_fingerprint)
- end
+ event = ::EventCreateService.new.wiki_event(wiki_page_meta, author, action, event_fingerprint)
ServiceResponse.success(payload: { event: event })
rescue ::EventCreateService::IllegalActionError, ::ActiveRecord::ActiveRecordError => e
diff --git a/config/metrics/counts_28d/20210816143831_i_code_review_total_suggestions_added_monthly.yml b/config/metrics/counts_28d/20210816143831_i_code_review_total_suggestions_added_monthly.yml
new file mode 100644
index 00000000000..4951444c0f7
--- /dev/null
+++ b/config/metrics/counts_28d/20210816143831_i_code_review_total_suggestions_added_monthly.yml
@@ -0,0 +1,27 @@
+---
+key_path: redis_hll_counters.code_review.i_code_review_total_suggestions_added_monthly
+name: "count_notes_with_suggestions_monthly"
+description: Total number of monthly suggestions
+product_section: dev
+product_stage: create
+product_group: group::code review
+product_category: code_review
+value_type: number
+status: implemented
+milestone: "14.3"
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67525
+time_frame: 28d
+data_source: redis_hll
+instrumentation_class: RedisHLLMetric
+options:
+ events:
+ - i_code_review_total_suggestions_added
+data_category: Optional
+performance_indicator_type: []
+distribution:
+- ce
+- ee
+tier:
+- free
+- premium
+- ultimate
diff --git a/config/metrics/counts_28d/20210816144453_i_code_review_total_suggestions_applied_monthly.yml b/config/metrics/counts_28d/20210816144453_i_code_review_total_suggestions_applied_monthly.yml
new file mode 100644
index 00000000000..50adfc81a15
--- /dev/null
+++ b/config/metrics/counts_28d/20210816144453_i_code_review_total_suggestions_applied_monthly.yml
@@ -0,0 +1,27 @@
+---
+key_path: redis_hll_counters.code_review.i_code_review_total_suggestions_applied_monthly
+name: "count_notes_with_applied_suggestions_monthly"
+description: Total number of monthly suggestions applied
+product_section: dev
+product_stage: create
+product_group: group::code review
+product_category: code_review
+value_type: number
+status: implemented
+milestone: "14.3"
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67525
+time_frame: 28d
+data_source: redis_hll
+instrumentation_class: RedisHLLMetric
+options:
+ events:
+ - i_code_review_total_suggestions_applied
+data_category: Optional
+performance_indicator_type: []
+distribution:
+- ce
+- ee
+tier:
+- free
+- premium
+- ultimate
diff --git a/config/metrics/counts_7d/20210816144119_i_code_review_total_suggestions_added_weekly.yml b/config/metrics/counts_7d/20210816144119_i_code_review_total_suggestions_added_weekly.yml
new file mode 100644
index 00000000000..694bb55a190
--- /dev/null
+++ b/config/metrics/counts_7d/20210816144119_i_code_review_total_suggestions_added_weekly.yml
@@ -0,0 +1,27 @@
+---
+key_path: redis_hll_counters.code_review.i_code_review_total_suggestions_added_weekly
+name: "count_notes_with_suggestions_weekly"
+description: Total number of weekly suggestions
+product_section: dev
+product_stage: create
+product_group: group::code review
+product_category: code_review
+value_type: number
+status: implemented
+milestone: "14.3"
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67525
+time_frame: 7d
+data_source: redis_hll
+instrumentation_class: RedisHLLMetric
+options:
+ events:
+ - i_code_review_total_suggestions_added
+data_category: Optional
+performance_indicator_type: []
+distribution:
+- ce
+- ee
+tier:
+- free
+- premium
+- ultimate
diff --git a/config/metrics/counts_7d/20210816144247_i_code_review_total_suggestions_applied_weekly.yml b/config/metrics/counts_7d/20210816144247_i_code_review_total_suggestions_applied_weekly.yml
new file mode 100644
index 00000000000..3bfb5014cff
--- /dev/null
+++ b/config/metrics/counts_7d/20210816144247_i_code_review_total_suggestions_applied_weekly.yml
@@ -0,0 +1,27 @@
+---
+key_path: redis_hll_counters.code_review.i_code_review_total_suggestions_applied_weekly
+name: "count_notes_with_applied_suggestions_weekly"
+description: Total number of weekly suggestions applied
+product_section: dev
+product_stage: create
+product_group: group::code review
+product_category: code_review
+value_type: number
+status: implemented
+milestone: "14.3"
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67525
+time_frame: 7d
+data_source: redis_hll
+instrumentation_class: RedisHLLMetric
+options:
+ events:
+ - i_code_review_total_suggestions_applied
+data_category: Optional
+performance_indicator_type: []
+distribution:
+- ce
+- ee
+tier:
+- free
+- premium
+- ultimate
diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md
index 4d0750953af..99cdb42adfd 100644
--- a/doc/integration/omniauth.md
+++ b/doc/integration/omniauth.md
@@ -73,14 +73,13 @@ earlier version, you must explicitly enable it.
- `auto_link_ldap_user` can be used if you have [LDAP / ActiveDirectory](../administration/auth/ldap/index.md)
integration enabled. It defaults to `false`. When enabled, users automatically
created through an OmniAuth provider have their LDAP identity created in GitLab as well.
-- `block_auto_created_users` defaults to `true`. If `true` auto created users will
- be blocked by default and must be unblocked by an administrator before
- they are able to sign in.
+- `block_auto_created_users` defaults to `true`. If `true`, auto created users will
+ be blocked pending approval by an administrator before they are able to sign in.
NOTE:
If you set `block_auto_created_users` to `false`, make sure to only
define providers under `allow_single_sign_on` that you are able to control, like
-SAML, Shibboleth, Crowd, or Google. Otherwise, set it to `false`, or any user on
+SAML, Shibboleth, Crowd, or Google. Otherwise, set it to `true`, or any user on
the Internet can successfully sign in to your GitLab without
administrative approval.
diff --git a/doc/topics/autodevops/index.md b/doc/topics/autodevops/index.md
index f4936e9162d..f6919453bca 100644
--- a/doc/topics/autodevops/index.md
+++ b/doc/topics/autodevops/index.md
@@ -105,7 +105,7 @@ test your application.
If you want to build, test, and deploy your app:
-1. See the [requirements for deployment](requirements.md).
+1. View the [requirements for deployment](requirements.md).
1. [Enable Auto DevOps](#enable-or-disable-auto-devops).
1. Follow the [quick start guide](#quick-start).
@@ -153,16 +153,18 @@ precedence over the Auto DevOps pipeline.
To enable Auto DevOps for a project:
-1. Go to your project's **Settings > CI/CD > Auto DevOps**.
-1. Select the **Default to Auto DevOps pipeline**.
-1. (Recommended) Add the [base domain](requirements.md#auto-devops-base-domain).
-1. (Recommended) Choose the [deployment strategy](requirements.md#auto-devops-deployment-strategy).
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > CI/CD**.
+1. Expand **Auto DevOps**.
+1. Select the **Default to Auto DevOps pipeline** checkbox.
+1. Optional but recommended. Add the [base domain](requirements.md#auto-devops-base-domain).
+1. Optional but recommended. Choose the [deployment strategy](requirements.md#auto-devops-deployment-strategy).
1. Select **Save changes**.
GitLab triggers the Auto DevOps pipeline on the default branch.
-To disable it, follow the same process and deselect **Default to Auto
-DevOps pipeline**.
+To disable it, follow the same process and clear the
+**Default to Auto DevOps pipeline** checkbox.
#### At the group level
@@ -180,20 +182,22 @@ at the group level.
To enable Auto DevOps for a group:
-1. Go to your group's **Settings > CI/CD > Auto DevOps**.
-1. Select **Default to Auto DevOps pipeline**.
+1. On the top bar, select **Menu > Groups** and find your group.
+1. On the left sidebar, select **Settings > CI/CD**.
+1. Expand **Auto DevOps**.
+1. Select the **Default to Auto DevOps pipeline** checkbox.
1. Select **Save changes**.
+To disable Auto DevOps on the group level, follow the same process and
+clear the **Default to Auto DevOps pipeline** checkbox.
+
After enabling Auto DevOps at the group level, you can trigger the
Auto DevOps pipeline for any project that belongs to that group. To do so:
-1. Go to the project's homepage.
+1. On the top bar, select **Menu > Projects** and find your project.
1. Make sure the project doesn't contain a `.gitlab-ci.yml` file.
-1. From the project's sidebar, go to **CI/CD > Pipelines**.
-1. Select **Run pipeline** to trigger the Auto DevOps pipeline.
-
-To disable Auto DevOps on the group level, follow the same process and
-deselect **Default to Auto DevOps pipeline**.
+1. On the left sidebar, select **CI/CD > Pipelines**.
+1. To trigger the Auto DevOps pipeline, select **Run pipeline**.
#### At the instance level **(FREE SELF)**
@@ -210,10 +214,11 @@ can still enable Auto DevOps at the group and project levels.
To enable Auto DevOps for your instance:
-1. From the top bar, select **Menu >** **{admin}** **Admin**.
-1. Go to **Settings > CI/CD > Continuous Integration and Deployment**.
-1. Select **Default to Auto DevOps pipeline**.
-1. (Optional) Add the Auto DevOps [base domain](requirements.md#auto-devops-base-domain).
+1. On the top bar, select **Menu >** **{admin}** **Admin**.
+1. On the left sidebar, select **Settings > CI/CD**.
+1. Expand **Auto DevOps**.
+1. Select the **Default to Auto DevOps pipeline** checkbox.
+1. Optional. Add the Auto DevOps [base domain](requirements.md#auto-devops-base-domain).
1. Select **Save changes**.
When enabled, it attempts to run Auto DevOps pipelines in every project. If the
@@ -224,7 +229,7 @@ If a [CI/CD configuration file](../../ci/yaml/index.md) is present,
it remains unchanged and Auto DevOps doesn't affect it.
To disable Auto DevOps in the instance level, follow the same process
-and deselect the **Default to Auto DevOps pipeline** checkbox.
+and clear the **Default to Auto DevOps pipeline** checkbox.
### Quick start
diff --git a/doc/user/admin_area/moderate_users.md b/doc/user/admin_area/moderate_users.md
index 8211167895c..7cbef82ea90 100644
--- a/doc/user/admin_area/moderate_users.md
+++ b/doc/user/admin_area/moderate_users.md
@@ -13,11 +13,12 @@ users.
## Users pending approval
A user in _pending approval_ state requires action by an administrator. A user sign up can be in a
-pending approval state because an administrator has enabled either, or both, of the following
-options:
+pending approval state because an administrator has enabled any of the following options:
- [Require admin approval for new sign-ups](settings/sign_up_restrictions.md#require-administrator-approval-for-new-sign-ups) setting.
- [User cap](settings/sign_up_restrictions.md#user-cap).
+- [Block auto-created users (OmniAuth)](../../integration/omniauth.md#initial-omniauth-configuration)
+- [Block auto-created users (LDAP)](../../administration/auth/ldap/index.md#basic-configuration-settings)
When a user registers for an account while this setting is enabled:
diff --git a/lib/gitlab/auth/o_auth/user.rb b/lib/gitlab/auth/o_auth/user.rb
index 1c5ded2e8ed..feb5fea4c85 100644
--- a/lib/gitlab/auth/o_auth/user.rb
+++ b/lib/gitlab/auth/o_auth/user.rb
@@ -54,7 +54,7 @@ module Gitlab
Users::UpdateService.new(gl_user, user: gl_user).execute!
- gl_user.block if block_after_save
+ gl_user.block_pending_approval if block_after_save
log.info "(#{provider}) saving user #{auth_hash.email} from login with admin => #{gl_user.admin}, extern_uid => #{auth_hash.uid}"
gl_user
diff --git a/lib/gitlab/import_export/attributes_permitter.rb b/lib/gitlab/import_export/attributes_permitter.rb
index 86f51add504..7c48e63941a 100644
--- a/lib/gitlab/import_export/attributes_permitter.rb
+++ b/lib/gitlab/import_export/attributes_permitter.rb
@@ -88,11 +88,15 @@ module Gitlab
end
def build_attributes
- @attributes_finder.included_attributes.each(&method(:add_permitted_attributes))
+ @attributes_finder.included_attributes.each do |model_name, attributes|
+ add_permitted_attributes(model_name, attributes)
+ end
end
def build_methods
- @attributes_finder.methods.each(&method(:add_permitted_attributes))
+ @attributes_finder.methods.each do |model_name, attributes|
+ add_permitted_attributes(model_name, attributes)
+ end
end
def add_permitted_attributes(model_name, attributes)
diff --git a/lib/gitlab/import_export/relation_tree_restorer.rb b/lib/gitlab/import_export/relation_tree_restorer.rb
index d5f924ae2bd..8d93098a80a 100644
--- a/lib/gitlab/import_export/relation_tree_restorer.rb
+++ b/lib/gitlab/import_export/relation_tree_restorer.rb
@@ -61,7 +61,9 @@ module Gitlab
# the configuration yaml file too.
# Finally, it updates each attribute in the newly imported project/group.
def create_relations!
- relations.each(&method(:process_relation!))
+ relations.each do |relation_key, relation_definition|
+ process_relation!(relation_key, relation_definition)
+ end
end
def process_relation!(relation_key, relation_definition)
diff --git a/lib/gitlab/timeless.rb b/lib/gitlab/timeless.rb
index 4f974c98c71..b72d33113dd 100644
--- a/lib/gitlab/timeless.rb
+++ b/lib/gitlab/timeless.rb
@@ -6,7 +6,8 @@ module Gitlab
original_record_timestamps = model.record_timestamps
model.record_timestamps = false
- if block.arity.abs == 1
+ # negative arity means arguments are optional
+ if block.arity == 1 || block.arity < 0
block.call(model)
else
block.call
diff --git a/lib/gitlab/usage_data_counters/known_events/code_review_events.yml b/lib/gitlab/usage_data_counters/known_events/code_review_events.yml
index 7ad51bfe832..103762501d4 100644
--- a/lib/gitlab/usage_data_counters/known_events/code_review_events.yml
+++ b/lib/gitlab/usage_data_counters/known_events/code_review_events.yml
@@ -237,3 +237,11 @@
category: code_review
aggregation: weekly
feature_flag: diff_searching_usage_data
+- name: i_code_review_total_suggestions_applied
+ redis_slot: code_review
+ category: code_review
+ aggregation: weekly
+- name: i_code_review_total_suggestions_added
+ redis_slot: code_review
+ category: code_review
+ aggregation: weekly
diff --git a/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb b/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
index 0d6f4b93aee..3bfd6c09fda 100644
--- a/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
+++ b/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter.rb
@@ -20,8 +20,10 @@ module Gitlab
MR_CREATE_MULTILINE_COMMENT_ACTION = 'i_code_review_user_create_multiline_mr_comment'
MR_EDIT_MULTILINE_COMMENT_ACTION = 'i_code_review_user_edit_multiline_mr_comment'
MR_REMOVE_MULTILINE_COMMENT_ACTION = 'i_code_review_user_remove_multiline_mr_comment'
- MR_ADD_SUGGESTION_ACTION = 'i_code_review_user_add_suggestion'
- MR_APPLY_SUGGESTION_ACTION = 'i_code_review_user_apply_suggestion'
+ MR_USER_ADD_SUGGESTION_ACTION = 'i_code_review_user_add_suggestion'
+ MR_TOTAL_ADD_SUGGESTION_ACTION = 'i_code_review_total_suggestions_added'
+ MR_USER_APPLY_SUGGESTION_ACTION = 'i_code_review_user_apply_suggestion'
+ MR_TOTAL_APPLY_SUGGESTION_ACTION = 'i_code_review_total_suggestions_applied'
MR_MARKED_AS_DRAFT_ACTION = 'i_code_review_user_marked_as_draft'
MR_UNMARKED_AS_DRAFT_ACTION = 'i_code_review_user_unmarked_as_draft'
MR_RESOLVE_THREAD_ACTION = 'i_code_review_user_resolve_thread'
@@ -112,8 +114,9 @@ module Gitlab
track_unique_action_by_user(MR_PUBLISH_REVIEW_ACTION, user)
end
- def track_add_suggestion_action(user:)
- track_unique_action_by_user(MR_ADD_SUGGESTION_ACTION, user)
+ def track_add_suggestion_action(note:)
+ track_unique_action_by_user(MR_USER_ADD_SUGGESTION_ACTION, note.author)
+ track_unique_action_by_objects(MR_TOTAL_ADD_SUGGESTION_ACTION, note.suggestions)
end
def track_marked_as_draft_action(user:)
@@ -124,16 +127,17 @@ module Gitlab
track_unique_action_by_user(MR_UNMARKED_AS_DRAFT_ACTION, user)
end
- def track_apply_suggestion_action(user:)
- track_unique_action_by_user(MR_APPLY_SUGGESTION_ACTION, user)
+ def track_apply_suggestion_action(user:, suggestions:)
+ track_unique_action_by_user(MR_USER_APPLY_SUGGESTION_ACTION, user)
+ track_unique_action_by_objects(MR_TOTAL_APPLY_SUGGESTION_ACTION, suggestions)
end
def track_users_assigned_to_mr(users:)
- track_unique_action_by_users(MR_ASSIGNED_USERS_ACTION, users)
+ track_unique_action_by_objects(MR_ASSIGNED_USERS_ACTION, users)
end
def track_users_review_requested(users:)
- track_unique_action_by_users(MR_REVIEW_REQUESTED_USERS_ACTION, users)
+ track_unique_action_by_objects(MR_REVIEW_REQUESTED_USERS_ACTION, users)
end
def track_title_edit_action(user:)
@@ -222,10 +226,10 @@ module Gitlab
track_unique_action(action, user.id)
end
- def track_unique_action_by_users(action, users)
- return if users.blank?
+ def track_unique_action_by_objects(action, objects)
+ return if objects.blank?
- track_unique_action(action, users.map(&:id))
+ track_unique_action(action, objects.map(&:id))
end
def track_unique_action(action, value)
diff --git a/lib/tasks/gitlab/graphql.rake b/lib/tasks/gitlab/graphql.rake
index 52c5c680292..b9137aa0d4c 100644
--- a/lib/tasks/gitlab/graphql.rake
+++ b/lib/tasks/gitlab/graphql.rake
@@ -111,7 +111,7 @@ namespace :gitlab do
desc 'GitLab | GraphQL | Generate GraphQL docs'
task compile_docs: [:environment, :enable_feature_flags] do
- renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, render_options)
+ renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, **render_options)
renderer.write
@@ -120,7 +120,7 @@ namespace :gitlab do
desc 'GitLab | GraphQL | Check if GraphQL docs are up to date'
task check_docs: [:environment, :enable_feature_flags] do
- renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, render_options)
+ renderer = Tooling::Graphql::Docs::Renderer.new(GitlabSchema, **render_options)
doc = File.read(Rails.root.join(OUTPUT_DIR, 'index.md'))
diff --git a/scripts/used-feature-flags b/scripts/used-feature-flags
index 07c022a4c1a..e6a8149da71 100755
--- a/scripts/used-feature-flags
+++ b/scripts/used-feature-flags
@@ -2,6 +2,7 @@
# frozen_string_literal: true
require 'set'
+require 'fileutils'
class String
def red
diff --git a/spec/controllers/omniauth_callbacks_controller_spec.rb b/spec/controllers/omniauth_callbacks_controller_spec.rb
index 9a142559fca..8c8de2f79a3 100644
--- a/spec/controllers/omniauth_callbacks_controller_spec.rb
+++ b/spec/controllers/omniauth_callbacks_controller_spec.rb
@@ -317,7 +317,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
it 'denies sign-in if sign-up is enabled, but block_auto_created_users is set' do
post :atlassian_oauth2
- expect(flash[:alert]).to start_with 'Your account has been blocked.'
+ expect(flash[:alert]).to start_with 'Your account is pending approval'
end
it 'accepts sign-in if sign-up is enabled' do
@@ -399,7 +399,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
it 'denies login if sign up is enabled, but block_auto_created_users is set' do
post :saml, params: { SAMLResponse: mock_saml_response }
- expect(flash[:alert]).to start_with 'Your account has been blocked.'
+ expect(flash[:alert]).to start_with 'Your account is pending approval'
end
it 'accepts login if sign up is enabled' do
diff --git a/spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb b/spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb
index a1dee442131..c4a84445a01 100644
--- a/spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb
+++ b/spec/lib/gitlab/usage_data_counters/code_review_events_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe 'Code review events' do
code_review_events = Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category("code_review")
- exceptions = %w[i_code_review_mr_diffs i_code_review_mr_single_file_diffs]
+ exceptions = %w[i_code_review_mr_diffs i_code_review_mr_single_file_diffs i_code_review_total_suggestions_applied i_code_review_total_suggestions_added]
code_review_aggregated_events += exceptions
expect(code_review_events - code_review_aggregated_events).to be_empty
diff --git a/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
index 041fc2f20a8..ec34479ff7e 100644
--- a/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
+++ b/spec/lib/gitlab/usage_data_counters/merge_request_activity_unique_counter_spec.rb
@@ -206,18 +206,32 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
end
describe '.track_add_suggestion_action' do
- subject { described_class.track_add_suggestion_action(user: user) }
+ subject { described_class.track_add_suggestion_action(note: note) }
+
+ before do
+ note.suggestions << build(:suggestion, id: 1, note: note)
+ end
+
+ it_behaves_like 'a tracked merge request unique event' do
+ let(:action) { described_class::MR_USER_ADD_SUGGESTION_ACTION }
+ end
it_behaves_like 'a tracked merge request unique event' do
- let(:action) { described_class::MR_ADD_SUGGESTION_ACTION }
+ let(:action) { described_class::MR_TOTAL_ADD_SUGGESTION_ACTION }
end
end
describe '.track_apply_suggestion_action' do
- subject { described_class.track_apply_suggestion_action(user: user) }
+ subject { described_class.track_apply_suggestion_action(user: user, suggestions: suggestions) }
+
+ let(:suggestions) { [build(:suggestion, id: 1, note: note)] }
+
+ it_behaves_like 'a tracked merge request unique event' do
+ let(:action) { described_class::MR_USER_APPLY_SUGGESTION_ACTION }
+ end
it_behaves_like 'a tracked merge request unique event' do
- let(:action) { described_class::MR_APPLY_SUGGESTION_ACTION }
+ let(:action) { described_class::MR_TOTAL_APPLY_SUGGESTION_ACTION }
end
end
diff --git a/spec/migrations/update_minimum_password_length_spec.rb b/spec/migrations/update_minimum_password_length_spec.rb
index 02254ba1343..e40d090fd77 100644
--- a/spec/migrations/update_minimum_password_length_spec.rb
+++ b/spec/migrations/update_minimum_password_length_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe UpdateMinimumPasswordLength do
before do
stub_const('ApplicationSetting::DEFAULT_MINIMUM_PASSWORD_LENGTH', 10)
- allow(Devise.password_length).to receive(:min).and_return(12)
+ allow(Devise).to receive(:password_length).and_return(12..20)
end
it 'correctly migrates minimum_password_length' do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 494d1de681d..26add23bde9 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -857,12 +857,8 @@ RSpec.describe User do
end
context 'maximum value' do
- before do
- allow(Devise.password_length).to receive(:max).and_return(201)
- end
-
it 'is determined by the current value of `Devise.password_length.max`' do
- expect(password_length.max).to eq(201)
+ expect(password_length.max).to eq(Devise.password_length.max)
end
end
end
diff --git a/spec/services/suggestions/apply_service_spec.rb b/spec/services/suggestions/apply_service_spec.rb
index 9cf794cde7e..d3dcbf0b668 100644
--- a/spec/services/suggestions/apply_service_spec.rb
+++ b/spec/services/suggestions/apply_service_spec.rb
@@ -79,7 +79,7 @@ RSpec.describe Suggestions::ApplyService do
it 'tracks apply suggestion event' do
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.to receive(:track_apply_suggestion_action)
- .with(user: user)
+ .with(user: user, suggestions: suggestions)
apply(suggestions)
end
diff --git a/spec/services/suggestions/create_service_spec.rb b/spec/services/suggestions/create_service_spec.rb
index 5148d6756fc..a4e62431128 100644
--- a/spec/services/suggestions/create_service_spec.rb
+++ b/spec/services/suggestions/create_service_spec.rb
@@ -159,7 +159,7 @@ RSpec.describe Suggestions::CreateService do
it 'tracks add suggestion event' do
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.to receive(:track_add_suggestion_action)
- .with(user: note.author)
+ .with(note: note)
subject.execute
end
diff --git a/spec/services/wiki_pages/event_create_service_spec.rb b/spec/services/wiki_pages/event_create_service_spec.rb
index 6bc6a678189..8476f872e98 100644
--- a/spec/services/wiki_pages/event_create_service_spec.rb
+++ b/spec/services/wiki_pages/event_create_service_spec.rb
@@ -34,10 +34,6 @@ RSpec.describe WikiPages::EventCreateService do
it 'does not create an event' do
expect { response }.not_to change(Event, :count)
end
-
- it 'does not create a metadata record' do
- expect { response }.not_to change(WikiPage::Meta, :count)
- end
end
it 'returns a successful response' do