Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
a7f07bb6
Commit
a7f07bb6
authored
Dec 23, 2018
by
Karen Konou
Browse files
Implement kaniini's tweaks
parent
c7617941
Pipeline
#5644
passed with stages
in 3 minutes and 22 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
View file @
a7f07bb6
...
...
@@ -2,13 +2,17 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
@behaviour
Pleroma
.
Web
.
ActivityPub
.
MRF
@impl
true
def
filter
(
object
)
do
policy
=
Pleroma
.
Config
.
get
(
:mrf_hellthread
)
def
filter
(%{
"type"
=>
"Create"
}
=
object
)
do
threshold
=
Pleroma
.
Config
.
get
([
:mrf_hellthread
,
:threshold
])
recipients
=
(
object
[
"to"
]
||
[])
++
(
object
[
"cc"
]
||
[])
if
length
(
object
[
"to"
])
+
length
(
object
[
"cc"
])
>
Keyword
.
get
(
policy
,
:
threshold
)
do
if
length
(
recipients
)
>
threshold
do
{
:reject
,
nil
}
else
{
:ok
,
object
}
end
end
@impl
true
def
filter
(
object
),
do
:
{
:ok
,
object
}
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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