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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-07 03:10:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-07 03:10:27 +0300
commitfd6093f6f04702cecf75306a83beba837cfde8fb (patch)
treed650796ad469f0ceef7de2b4a0da5a4fb6a8b618 /lib/gitlab/spamcheck
parent454973238cb3eed58f7d901b87ceb29acf6febbd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/spamcheck')
-rw-r--r--lib/gitlab/spamcheck/client.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/spamcheck/client.rb b/lib/gitlab/spamcheck/client.rb
index 74a3a298bce..e4dfb3da0f3 100644
--- a/lib/gitlab/spamcheck/client.rb
+++ b/lib/gitlab/spamcheck/client.rb
@@ -11,7 +11,8 @@ module Gitlab
::Spamcheck::SpamVerdict::Verdict::ALLOW => ALLOW,
::Spamcheck::SpamVerdict::Verdict::CONDITIONAL_ALLOW => CONDITIONAL_ALLOW,
::Spamcheck::SpamVerdict::Verdict::DISALLOW => DISALLOW,
- ::Spamcheck::SpamVerdict::Verdict::BLOCK => BLOCK_USER
+ ::Spamcheck::SpamVerdict::Verdict::BLOCK => BLOCK_USER,
+ ::Spamcheck::SpamVerdict::Verdict::NOOP => NOOP
}.freeze
ACTION_MAPPING = {
@@ -60,6 +61,7 @@ module Gitlab
issue_pb.created_at = convert_to_pb_timestamp(issue.created_at) if issue.created_at
issue_pb.updated_at = convert_to_pb_timestamp(issue.updated_at) if issue.updated_at
issue_pb.user_in_project = user.authorized_project?(issue.project)
+ issue_pb.project = build_project_protobuf(issue)
issue_pb.action = ACTION_MAPPING.fetch(context.fetch(:action)) if context.has_key?(:action)
issue_pb.user = build_user_protobuf(user)
issue_pb
@@ -87,6 +89,13 @@ module Gitlab
email_pb
end
+ def build_project_protobuf(issue)
+ project_pb = ::Spamcheck::Project.new
+ project_pb.project_id = issue.project_id
+ project_pb.project_path = issue.project.full_path
+ project_pb
+ end
+
def convert_to_pb_timestamp(ar_timestamp)
Google::Protobuf::Timestamp.new(seconds: ar_timestamp.to_time.to_i,
nanos: ar_timestamp.to_time.nsec)