Skip to content
GitLab
Menu
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
8baaa36a
Verified
Commit
8baaa36a
authored
Aug 10, 2021
by
Haelwenn
Browse files
ObjectAgePolicy: Fix pattern matching on published
Backport of:
!3500
parent
1cf89de8
Changes
3
Show whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
8baaa36a
...
...
@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
-
MastodonAPI: Stream out Create activities
-
MRF ObjectAgePolicy: Fix pattern matching on "published"
## 2.4.0 - 2021-08-08
...
...
lib/pleroma/web/activity_pub/mrf/object_age_policy.ex
View file @
8baaa36a
...
...
@@ -49,6 +49,8 @@ defp check_delist(message, actions) do
message
|>
Map
.
put
(
"to"
,
to
)
|>
Map
.
put
(
"cc"
,
cc
)
|>
Kernel
.
put_in
([
"object"
,
"to"
],
to
)
|>
Kernel
.
put_in
([
"object"
,
"cc"
],
cc
)
{
:ok
,
message
}
else
...
...
@@ -70,6 +72,8 @@ defp check_strip_followers(message, actions) do
message
|>
Map
.
put
(
"to"
,
to
)
|>
Map
.
put
(
"cc"
,
cc
)
|>
Kernel
.
put_in
([
"object"
,
"to"
],
to
)
|>
Kernel
.
put_in
([
"object"
,
"cc"
],
cc
)
{
:ok
,
message
}
else
...
...
@@ -82,7 +86,7 @@ defp check_strip_followers(message, actions) do
end
@impl
true
def
filter
(%{
"type"
=>
"Create"
,
"published"
=>
_
}
=
message
)
do
def
filter
(%{
"type"
=>
"Create"
,
"object"
=>
%{
"published"
=>
_
}
}
=
message
)
do
with
actions
<-
Config
.
get
([
:mrf_object_age
,
:actions
]),
{
:reject
,
_
}
<-
check_date
(
message
),
{
:ok
,
message
}
<-
check_reject
(
message
,
actions
),
...
...
test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs
View file @
8baaa36a
...
...
@@ -22,6 +22,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
defp
get_old_message
do
File
.
read!
(
"test/fixtures/mastodon-post-activity.json"
)
|>
Jason
.
decode!
()
|>
Map
.
drop
([
"published"
])
end
defp
get_new_message
do
...
...
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