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
923584d0
Commit
923584d0
authored
Apr 22, 2017
by
lain
Browse files
Remove unknown activities from feed.
parent
c585f9e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/ostatus/activity_representer.ex
View file @
923584d0
...
...
@@ -22,4 +22,6 @@ def to_simple_form(%{data: %{"object" => %{"type" => "Note"}}} = activity, user)
{
:updated
,
h
.
(
updated_at
)}
]
++
attachments
end
def
to_simple_form
(
_
,
_
),
do
:
nil
end
lib/pleroma/web/ostatus/feed_representer.ex
View file @
923584d0
...
...
@@ -11,6 +11,7 @@ def to_simple_form(user, activities, users) do
entries
=
Enum
.
map
(
activities
,
fn
(
activity
)
->
{
:entry
,
ActivityRepresenter
.
to_simple_form
(
activity
,
user
)}
end
)
|>
Enum
.
filter
(
fn
({
_
,
form
})
->
form
end
)
[{
:feed
,
[
...
...
lib/pleroma/web/websub/websub.ex
View file @
923584d0
defmodule
Pleroma
.
Web
.
Websub
do
alias
Pleroma
.
Repo
alias
Pleroma
.
Websub
alias
Pleroma
.
Web
.
Websub
.
WebsubServerSubscription
alias
Pleroma
.
Web
.
OStatus
.
FeedRepresenter
alias
Pleroma
.
Web
.
OStatus
...
...
test/web/ostatus/activity_representer_test.exs
View file @
923584d0
...
...
@@ -2,7 +2,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
use
Pleroma
.
DataCase
alias
Pleroma
.
Web
.
OStatus
.
ActivityRepresenter
alias
Pleroma
.
User
alias
Pleroma
.
{
User
,
Activity
}
import
Pleroma
.
Factory
...
...
@@ -32,6 +32,11 @@ test "a note activity" do
assert
clean
(
res
)
==
clean
(
expected
)
end
test
"an unknown activity"
do
tuple
=
ActivityRepresenter
.
to_simple_form
(%
Activity
{},
nil
)
assert
is_nil
(
tuple
)
end
defp
clean
(
string
)
do
String
.
replace
(
string
,
~r/\s/
,
""
)
end
...
...
Write
Preview
Supports
Markdown
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