diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-16 12:08:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-16 12:08:32 +0000 |
commit | c158fa8d69c704663d289341a014c44c062cda88 (patch) | |
tree | d0cac82a9ac9e9ad28bb0030266eb8d5dc91fbbc /app/services/spam | |
parent | b806264d29b8d52ccb78a41dcc3d67f2b040700c (diff) | |
download | gitlab-ce-c158fa8d69c704663d289341a014c44c062cda88.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/spam')
-rw-r--r-- | app/services/spam/mark_as_spam_service.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/services/spam/mark_as_spam_service.rb b/app/services/spam/mark_as_spam_service.rb new file mode 100644 index 00000000000..0ebcf17927a --- /dev/null +++ b/app/services/spam/mark_as_spam_service.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Spam + class MarkAsSpamService + include ::AkismetMethods + + attr_accessor :spammable, :options + + def initialize(spammable:) + @spammable = spammable + @options = {} + + @options[:ip_address] = @spammable.ip_address + @options[:user_agent] = @spammable.user_agent + end + + def execute + return unless spammable.submittable_as_spam? + return unless akismet.submit_spam + + spammable.user_agent_detail.update_attribute(:submitted, true) + end + end +end |