Remove unknown activities from feed.
This commit is contained in:
parent
c585f9e26c
commit
923584d046
4 changed files with 9 additions and 2 deletions
|
@ -22,4 +22,6 @@ def to_simple_form(%{data: %{"object" => %{"type" => "Note"}}} = activity, user)
|
||||||
{:updated, h.(updated_at)}
|
{:updated, h.(updated_at)}
|
||||||
] ++ attachments
|
] ++ attachments
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_simple_form(_,_), do: nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ def to_simple_form(user, activities, users) do
|
||||||
entries = Enum.map(activities, fn(activity) ->
|
entries = Enum.map(activities, fn(activity) ->
|
||||||
{:entry, ActivityRepresenter.to_simple_form(activity, user)}
|
{:entry, ActivityRepresenter.to_simple_form(activity, user)}
|
||||||
end)
|
end)
|
||||||
|
|> Enum.filter(fn ({_, form}) -> form end)
|
||||||
|
|
||||||
[{
|
[{
|
||||||
:feed, [
|
:feed, [
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
defmodule Pleroma.Web.Websub do
|
defmodule Pleroma.Web.Websub do
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
alias Pleroma.Websub
|
|
||||||
alias Pleroma.Web.Websub.WebsubServerSubscription
|
alias Pleroma.Web.Websub.WebsubServerSubscription
|
||||||
alias Pleroma.Web.OStatus.FeedRepresenter
|
alias Pleroma.Web.OStatus.FeedRepresenter
|
||||||
alias Pleroma.Web.OStatus
|
alias Pleroma.Web.OStatus
|
||||||
|
|
|
@ -2,7 +2,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
|
||||||
use Pleroma.DataCase
|
use Pleroma.DataCase
|
||||||
|
|
||||||
alias Pleroma.Web.OStatus.ActivityRepresenter
|
alias Pleroma.Web.OStatus.ActivityRepresenter
|
||||||
alias Pleroma.User
|
alias Pleroma.{User, Activity}
|
||||||
|
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
|
|
||||||
|
@ -32,6 +32,11 @@ test "a note activity" do
|
||||||
assert clean(res) == clean(expected)
|
assert clean(res) == clean(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "an unknown activity" do
|
||||||
|
tuple = ActivityRepresenter.to_simple_form(%Activity{}, nil)
|
||||||
|
assert is_nil(tuple)
|
||||||
|
end
|
||||||
|
|
||||||
defp clean(string) do
|
defp clean(string) do
|
||||||
String.replace(string, ~r/\s/, "")
|
String.replace(string, ~r/\s/, "")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue