forked from AkkomaGang/akkoma
EnsureRePrepended: Don't break on chat messages.
This commit is contained in:
parent
93dbba9b8a
commit
edf8b6abfe
2 changed files with 12 additions and 1 deletions
|
@ -27,7 +27,8 @@ def filter_by_summary(
|
||||||
|
|
||||||
def filter_by_summary(_in_reply_to, child), do: child
|
def filter_by_summary(_in_reply_to, child), do: child
|
||||||
|
|
||||||
def filter(%{"type" => "Create", "object" => child_object} = object) do
|
def filter(%{"type" => "Create", "object" => child_object} = object)
|
||||||
|
when is_map(child_object) do
|
||||||
child =
|
child =
|
||||||
child_object["inReplyTo"]
|
child_object["inReplyTo"]
|
||||||
|> Object.normalize(child_object["inReplyTo"])
|
|> Object.normalize(child_object["inReplyTo"])
|
||||||
|
|
|
@ -78,5 +78,15 @@ test "it skip if parent and child summary isn't equal" do
|
||||||
assert {:ok, res} = EnsureRePrepended.filter(message)
|
assert {:ok, res} = EnsureRePrepended.filter(message)
|
||||||
assert res == message
|
assert res == message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it skips if the object is only a reference" do
|
||||||
|
message = %{
|
||||||
|
"type" => "Create",
|
||||||
|
"object" => "somereference"
|
||||||
|
}
|
||||||
|
|
||||||
|
assert {:ok, res} = EnsureRePrepended.filter(message)
|
||||||
|
assert res == message
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue