diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-15 06:11:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-15 06:11:59 +0300 |
commit | 29c6745feab7edf3c0485b34b5e5fffdded9c402 (patch) | |
tree | 0953ef194cd5a2cd4ad750804ffe135539b46f6b /lib/gitlab | |
parent | ff45b1aea7367cf98a5b70e8324e4826c119bf87 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/application_rate_limiter.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/bitbucket_server_import/importers/pull_requests_importer.rb | 26 | ||||
-rw-r--r-- | lib/gitlab/gon_helper.rb | 1 |
3 files changed, 28 insertions, 3 deletions
diff --git a/lib/gitlab/application_rate_limiter.rb b/lib/gitlab/application_rate_limiter.rb index 469927b8a53..47dab17adda 100644 --- a/lib/gitlab/application_rate_limiter.rb +++ b/lib/gitlab/application_rate_limiter.rb @@ -52,8 +52,8 @@ module Gitlab project_testing_integration: { threshold: 5, interval: 1.minute }, email_verification: { threshold: 10, interval: 10.minutes }, email_verification_code_send: { threshold: 10, interval: 1.hour }, - phone_verification_send_code: { threshold: 10, interval: 1.hour }, - phone_verification_verify_code: { threshold: 10, interval: 10.minutes }, + phone_verification_send_code: { threshold: 10, interval: 1.day }, + phone_verification_verify_code: { threshold: 10, interval: 1.day }, namespace_exists: { threshold: 20, interval: 1.minute }, update_namespace_name: { threshold: -> { application_settings.update_namespace_name_rate_limit }, interval: 1.hour }, fetch_google_ip_list: { threshold: 10, interval: 1.minute }, diff --git a/lib/gitlab/bitbucket_server_import/importers/pull_requests_importer.rb b/lib/gitlab/bitbucket_server_import/importers/pull_requests_importer.rb index ae73681f7f8..ce9f18feaa8 100644 --- a/lib/gitlab/bitbucket_server_import/importers/pull_requests_importer.rb +++ b/lib/gitlab/bitbucket_server_import/importers/pull_requests_importer.rb @@ -24,7 +24,15 @@ module Gitlab next if already_processed?(pull_request) next unless pull_request.merged? || pull_request.closed? - [pull_request.source_branch_sha, pull_request.target_branch_sha] + [].tap do |commits| + source_sha = pull_request.source_branch_sha + target_sha = pull_request.target_branch_sha + + existing_commits = repo.commits_by(oids: [source_sha, target_sha]).map(&:sha) + + commits << source_branch_commit(source_sha, pull_request) unless existing_commits.include?(source_sha) + commits << target_branch_commit(target_sha) unless existing_commits.include?(target_sha) + end end.flatten # Bitbucket Server keeps tracks of references for open pull requests in @@ -78,6 +86,22 @@ module Gitlab def id_for_already_processed_cache(object) object.iid end + + def repo + @repo ||= project.repository + end + + def ref_path(pull_request) + "refs/#{Repository::REF_MERGE_REQUEST}/#{pull_request.iid}/head" + end + + def source_branch_commit(source_branch_sha, pull_request) + [source_branch_sha, ':', ref_path(pull_request)].join + end + + def target_branch_commit(target_branch_sha) + [target_branch_sha, ':refs/keep-around/', target_branch_sha].join + end end end end diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 59813e4f5a0..2f83f96d051 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -77,6 +77,7 @@ module Gitlab push_frontend_feature_flag(:security_auto_fix) push_frontend_feature_flag(:source_editor_toolbar) push_frontend_feature_flag(:vscode_web_ide, current_user) + push_frontend_feature_flag(:frecent_namespaces_suggestions, current_user) # To be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/399248 push_frontend_feature_flag(:remove_monitor_metrics) push_frontend_feature_flag(:custom_emoji) |