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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-06 18:09:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-06 18:09:27 +0300
commit638e2f1c5f55988135da63c7aa57bcecb9355a2b (patch)
treec25a1deeec9e02411f52a5eb831c42fa41778f9a /lib
parent4958d96e262f6b31b2850123e4949536555b2d29 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/issues.rb7
-rw-r--r--lib/api/project_snippets.rb8
-rw-r--r--lib/api/snippets.rb8
-rw-r--r--lib/gitlab/database/schema_validation/track_inconsistency.rb7
-rw-r--r--lib/gitlab/email/handler/create_issue_handler.rb2
-rw-r--r--lib/gitlab/email/handler/service_desk_handler.rb2
-rw-r--r--lib/gitlab/slash_commands/issue_new.rb2
-rw-r--r--lib/gitlab/usage_data_counters/hll_redis_counter.rb5
-rw-r--r--lib/quality/seeders/issues.rb2
9 files changed, 17 insertions, 26 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index d033913aa71..a0f7c5c9b21 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -271,11 +271,9 @@ module API
issue_params = convert_parameters_from_legacy_format(issue_params)
begin
- spam_params = ::Spam::SpamParams.new_from_request(request: request)
result = ::Issues::CreateService.new(container: user_project,
current_user: current_user,
- params: issue_params,
- spam_params: spam_params).execute
+ params: issue_params).execute
if result.success?
present result[:issue], with: Entities::Issue, current_user: current_user, project: user_project
@@ -318,11 +316,10 @@ module API
update_params = convert_parameters_from_legacy_format(update_params)
- spam_params = ::Spam::SpamParams.new_from_request(request: request)
issue = ::Issues::UpdateService.new(container: user_project,
current_user: current_user,
params: update_params,
- spam_params: spam_params).execute(issue)
+ perform_spam_check: true).execute(issue)
if issue.valid?
present issue, with: Entities::Issue, current_user: current_user, project: user_project
diff --git a/lib/api/project_snippets.rb b/lib/api/project_snippets.rb
index 7ef722301ca..a503b941593 100644
--- a/lib/api/project_snippets.rb
+++ b/lib/api/project_snippets.rb
@@ -90,9 +90,7 @@ module API
authorize! :create_snippet, user_project
snippet_params = process_create_params(declared_params(include_missing: false))
-
- spam_params = ::Spam::SpamParams.new_from_request(request: request)
- service_response = ::Snippets::CreateService.new(project: user_project, current_user: current_user, params: snippet_params, spam_params: spam_params).execute
+ service_response = ::Snippets::CreateService.new(project: user_project, current_user: current_user, params: snippet_params).execute
snippet = service_response.payload[:snippet]
if service_response.success?
@@ -138,9 +136,7 @@ module API
validate_params_for_multiple_files(snippet)
snippet_params = process_update_params(declared_params(include_missing: false))
-
- spam_params = ::Spam::SpamParams.new_from_request(request: request)
- service_response = ::Snippets::UpdateService.new(project: user_project, current_user: current_user, params: snippet_params, spam_params: spam_params).execute(snippet)
+ service_response = ::Snippets::UpdateService.new(project: user_project, current_user: current_user, params: snippet_params, perform_spam_check: true).execute(snippet)
snippet = service_response.payload[:snippet]
if service_response.success?
diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb
index 104848206a3..77872e7d13c 100644
--- a/lib/api/snippets.rb
+++ b/lib/api/snippets.rb
@@ -113,9 +113,7 @@ module API
authorize! :create_snippet
attrs = process_create_params(declared_params(include_missing: false))
-
- spam_params = ::Spam::SpamParams.new_from_request(request: request)
- service_response = ::Snippets::CreateService.new(project: nil, current_user: current_user, params: attrs, spam_params: spam_params).execute
+ service_response = ::Snippets::CreateService.new(project: nil, current_user: current_user, params: attrs).execute
snippet = service_response.payload[:snippet]
if service_response.success?
@@ -162,9 +160,7 @@ module API
validate_params_for_multiple_files(snippet)
attrs = process_update_params(declared_params(include_missing: false))
-
- spam_params = ::Spam::SpamParams.new_from_request(request: request)
- service_response = ::Snippets::UpdateService.new(project: nil, current_user: current_user, params: attrs, spam_params: spam_params).execute(snippet)
+ service_response = ::Snippets::UpdateService.new(project: nil, current_user: current_user, params: attrs, perform_spam_check: true).execute(snippet)
snippet = service_response.payload[:snippet]
diff --git a/lib/gitlab/database/schema_validation/track_inconsistency.rb b/lib/gitlab/database/schema_validation/track_inconsistency.rb
index 524c114810f..6e167653d32 100644
--- a/lib/gitlab/database/schema_validation/track_inconsistency.rb
+++ b/lib/gitlab/database/schema_validation/track_inconsistency.rb
@@ -16,8 +16,11 @@ module Gitlab
return unless Gitlab.com?
return refresh_issue if inconsistency_record.present?
- result = ::Issues::CreateService.new(container: project, current_user: user, params: params,
- spam_params: nil).execute
+ result = ::Issues::CreateService.new(
+ container: project,
+ current_user: user,
+ params: params,
+ perform_spam_check: false).execute
track_inconsistency(result[:issue]) if result.success?
end
diff --git a/lib/gitlab/email/handler/create_issue_handler.rb b/lib/gitlab/email/handler/create_issue_handler.rb
index c325112b673..869bcc6e2be 100644
--- a/lib/gitlab/email/handler/create_issue_handler.rb
+++ b/lib/gitlab/email/handler/create_issue_handler.rb
@@ -68,7 +68,7 @@ module Gitlab
title: mail.subject,
description: message_including_reply_or_only_quotes
},
- spam_params: nil
+ perform_spam_check: false
).execute
end
diff --git a/lib/gitlab/email/handler/service_desk_handler.rb b/lib/gitlab/email/handler/service_desk_handler.rb
index 076ba42daac..215ba77db13 100644
--- a/lib/gitlab/email/handler/service_desk_handler.rb
+++ b/lib/gitlab/email/handler/service_desk_handler.rb
@@ -103,7 +103,7 @@ module Gitlab
cc: mail.cc
}
},
- spam_params: nil
+ perform_spam_check: false
).execute
raise InvalidIssueError if result.error?
diff --git a/lib/gitlab/slash_commands/issue_new.rb b/lib/gitlab/slash_commands/issue_new.rb
index 508526ac500..dd2bf632e2c 100644
--- a/lib/gitlab/slash_commands/issue_new.rb
+++ b/lib/gitlab/slash_commands/issue_new.rb
@@ -37,7 +37,7 @@ module Gitlab
private
def create_issue(title:, description:)
- ::Issues::CreateService.new(container: project, current_user: current_user, params: { title: title, description: description }, spam_params: nil).execute
+ ::Issues::CreateService.new(container: project, current_user: current_user, params: { title: title, description: description }, perform_spam_check: false).execute
end
def presenter(issue)
diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb
index 7ddd496cd85..badcda1def0 100644
--- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb
+++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb
@@ -120,12 +120,11 @@ module Gitlab
aggregation = events.first[:aggregation]
if Feature.disabled?(:revert_daily_hll_events_to_weekly_aggregation)
- aggregation = :weekly
- events.each { |e| e[:aggregation] = :weekly }
+ aggregation = 'weekly'
+ events = events.map { |e| e.merge(aggregation: 'weekly') }
end
keys = keys_for_aggregation(aggregation, events: events, start_date: start_date, end_date: end_date, context: context)
-
return FALLBACK unless keys.any?
redis_usage_data { Gitlab::Redis::HLL.count(keys: keys) }
diff --git a/lib/quality/seeders/issues.rb b/lib/quality/seeders/issues.rb
index cac034767f6..fb3d78bc8d2 100644
--- a/lib/quality/seeders/issues.rb
+++ b/lib/quality/seeders/issues.rb
@@ -31,7 +31,7 @@ module Quality
}
params[:closed_at] = params[:created_at] + rand(35).days if params[:state] == 'closed'
- create_result = ::Issues::CreateService.new(container: project, current_user: team.sample, params: params, spam_params: nil).execute_without_rate_limiting
+ create_result = ::Issues::CreateService.new(container: project, current_user: team.sample, params: params, perform_spam_check: false).execute_without_rate_limiting
if create_result.success?
created_issues_count += 1