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:
Diffstat (limited to 'app/services/spam/spam_action_service.rb')
-rw-r--r--app/services/spam/spam_action_service.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/services/spam/spam_action_service.rb b/app/services/spam/spam_action_service.rb
index 6ec8d09c37c..cca0bb709aa 100644
--- a/app/services/spam/spam_action_service.rb
+++ b/app/services/spam/spam_action_service.rb
@@ -78,14 +78,17 @@ module Spam
when BLOCK_USER
target.spam!
create_spam_log
+ create_spam_abuse_event(result)
ban_user!
when DISALLOW
target.spam!
create_spam_log
+ create_spam_abuse_event(result)
when CONDITIONAL_ALLOW
# This means "require a CAPTCHA to be solved"
target.needs_recaptcha!
create_spam_log
+ create_spam_abuse_event(result)
when OVERRIDE_VIA_ALLOW_POSSIBLE_SPAM
create_spam_log
when ALLOW
@@ -118,6 +121,22 @@ module Spam
target.spam_log = spam_log
end
+ def create_spam_abuse_event(result)
+ params = {
+ user_id: user.id,
+ title: target.spam_title,
+ description: target.spam_description,
+ source_ip: spam_params&.ip_address,
+ user_agent: spam_params&.user_agent,
+ noteable_type: noteable_type,
+ verdict: result
+ }
+
+ target.run_after_commit_or_now do
+ Abuse::SpamAbuseEventsWorker.perform_async(params)
+ end
+ end
+
def ban_user!
UserCustomAttribute.set_banned_by_spam_log(target.spam_log)