Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
(feature): Steward changes
· 61be5521
Nicholas Lewis
authored
Jul 24, 2019
and
Mark Harding
committed
Jul 24, 2019
61be5521
Merge branch 'stewardChanges' into 'master'
· 2f9601c0
Mark Harding
authored
Jul 24, 2019
(feature): Steward changes See merge request
!225
2f9601c0
Hide whitespace changes
Inline
Side-by-side
Core/Steward/AutoReporter.php
View file @
2f9601c0
...
...
@@ -50,43 +50,62 @@ class AutoReporter
$this
->
dictionary
[
'adult'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'amateur'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'anal'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'anilingus'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
4
);
$this
->
dictionary
[
'asian'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'ass'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'autoerotic'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
2
);
$this
->
dictionary
[
'babe'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'bangbros'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
4
);
$this
->
dictionary
[
'banislam'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_RACE
,
5
);
$this
->
dictionary
[
'bareback'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'barenaked'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
3
);
$this
->
dictionary
[
'bbw'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
2
);
$this
->
dictionary
[
'bdsm'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
5
);
$this
->
dictionary
[
'beastiality'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
5
);
$this
->
dictionary
[
'beauty'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'bendover'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'bigboobs'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'bimbos'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'blowjob'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
5
);
$this
->
dictionary
[
'blumpkin'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
5
);
$this
->
dictionary
[
'bondage'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'b
ukkake
'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
5
);
$this
->
dictionary
[
'b
oner
'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'boobs'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'breeding'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'bukkake'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
5
);
$this
->
dictionary
[
'busty'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'butt'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'buttplug'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'camgirls'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'camslut'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
2
);
$this
->
dictionary
[
'christchurch'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_RACE
,
5
);
$this
->
dictionary
[
'circlejerk'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'clit'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'cock'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
5
);
$this
->
dictionary
[
'cornhole'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'creampie'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'cuck'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'cuckold'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'cum'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'cunnilingus'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'dead'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_VIOLENCE
,
3
);
$this
->
dictionary
[
'deepthroat'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'dfc'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'dick'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'dildo'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'dom'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'dominatrix'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'ebony'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'ecchi'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'ejaculation'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'erotica'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'faggot'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PROFANITY
,
10
);
$this
->
dictionary
[
'fellatio'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
4
);
$this
->
dictionary
[
'fet'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'fetish'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'fetlife'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'fingering'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'fisting'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'footfetish'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'gang'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'gangbang'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
...
...
@@ -94,12 +113,16 @@ class AutoReporter
$this
->
dictionary
[
'girls'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'goy'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_RACE
,
1
);
$this
->
dictionary
[
'goyim'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_RACE
,
1
);
$this
->
dictionary
[
'grope'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'hardcore'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'heels'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'hentai'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'hitler'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_RACE
,
3
);
$this
->
dictionary
[
'holocaust'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_RACE
,
3
);
$this
->
dictionary
[
'hot'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'hooker'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
4
);
$this
->
dictionary
[
'incest'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
4
);
$this
->
dictionary
[
'intercourse'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'jew'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_RACE
,
1
);
$this
->
dictionary
[
'kike'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_RACE
,
10
);
$this
->
dictionary
[
'kill'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_VIOLENCE
,
3
);
...
...
@@ -125,9 +148,13 @@ class AutoReporter
$this
->
dictionary
[
'nudist'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'nudity'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'nylon'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'nympho'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'orgasm'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
2
);
$this
->
dictionary
[
'orgy'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'oppai'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'pantyhose'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'penis'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
3
);
$this
->
dictionary
[
'playboy'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
3
);
$this
->
dictionary
[
'porn'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
10
);
$this
->
dictionary
[
'pornstar'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'pussy'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
...
...
@@ -143,13 +170,19 @@ class AutoReporter
$this
->
dictionary
[
'threesome'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'tits'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'titties'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'topless'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'twink'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'unicorn'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
1
);
$this
->
dictionary
[
'upskirt'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
3
);
$this
->
dictionary
[
'vagina'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_NUDITY
,
1
);
$this
->
dictionary
[
'waifu'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'wank'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'webcam'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'whore'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PROFANITY
,
5
);
$this
->
dictionary
[
'woa'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'xxx'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
10
);
$this
->
dictionary
[
'yiffy'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
$this
->
dictionary
[
'zoophilia'
]
=
new
Reason
(
REASON
::
REASON_NSFW
,
REASON
::
REASON_NSFW_PORNOGRAPHY
,
3
);
}
/**
...
...
Spec/Core/Steward/AutoReporterSpec.php
View file @
2f9601c0
...
...
@@ -116,6 +116,30 @@ class AutoReporterSpec extends ObjectBehavior
expect
(
$scoredReason
->
getSubreasonCode
())
->
toEqual
(
Reason
::
REASON_NSFW_PORNOGRAPHY
);
expect
(
$scoredReason
->
getWeight
())
->
toEqual
(
4
);
}
public
function
it_should_report_more_bad_words
()
{
$entity
=
(
new
Entity
())
->
set
(
'guid'
,
456
)
->
set
(
'owner_guid'
,
789
)
->
set
(
'message'
,
'this is only a test: anilingus'
);
$report
=
(
new
Reports\Report
())
->
setEntityGuid
(
$entity
->
guid
)
->
setEntityOwnerGuid
(
$entity
->
get
(
'owner_guid'
));
$autoReport
=
(
new
Reports\UserReports\UserReport
())
->
setReport
(
$report
)
->
setReporterGuid
(
$this
->
stewardUser
->
guid
)
->
setReasonCode
(
Reason
::
REASON_NSFW
)
->
setSubReasonCode
(
Reason
::
REASON_NSFW_PORNOGRAPHY
)
->
setTimestamp
(
1
);
$this
->
reportManager
->
add
(
$autoReport
)
->
shouldBeCalled
();
$scoredReason
=
$this
->
validate
(
$entity
,
1
)
->
getWrappedObject
();
expect
(
$scoredReason
->
getReasonCode
())
->
toEqual
(
Reason
::
REASON_NSFW
);
expect
(
$scoredReason
->
getSubreasonCode
())
->
toEqual
(
Reason
::
REASON_NSFW_PORNOGRAPHY
);
expect
(
$scoredReason
->
getWeight
())
->
toEqual
(
4
);
}
public
function
it_should_not_report_words
()
{
...
...