Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
43e25d6e
Commit
43e25d6e
authored
Feb 06, 2020
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify HamService to use AkismetMethods
parent
8b39d9ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
app/services/concerns/akismet_methods.rb
app/services/concerns/akismet_methods.rb
+1
-1
app/services/spam/ham_service.rb
app/services/spam/ham_service.rb
+9
-13
No files found.
app/services/concerns/akismet_methods.rb
View file @
43e25d6e
...
...
@@ -9,7 +9,7 @@ module AkismetMethods
@akismet
||=
Spam
::
AkismetService
.
new
(
spammable_owner
.
name
,
spammable_owner
.
email
,
spammable
.
spammable_
text
,
spammable
.
try
(
:spammable_text
)
||
spammable
&
.
text
,
options
)
end
...
...
app/services/spam/ham_service.rb
View file @
43e25d6e
...
...
@@ -2,10 +2,17 @@
module
Spam
class
HamService
attr_accessor
:spam_log
include
AkismetMethods
attr_accessor
:spam_log
,
:options
def
initialize
(
spam_log
)
@spam_log
=
spam_log
@user
=
spam_log
.
user
@options
=
{
ip_address:
spam_log
.
source_ip
,
user_agent:
spam_log
.
user_agent
}
end
def
mark_as_ham!
...
...
@@ -16,17 +23,6 @@ module Spam
end
end
private
def
akismet
user
=
spam_log
.
user
@akismet
||=
AkismetService
.
new
(
user
.
name
,
user
.
email
,
spam_log
.
text
,
ip_address:
spam_log
.
source_ip
,
user_agent:
spam_log
.
user_agent
)
end
alias_method
:spammable
,
:spam_log
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment