Merge branch 'discard-invalid-likes' into 'develop'
Transmogrifier: fix incoming objects with invalid likes See merge request pleroma/pleroma!724
This commit is contained in:
commit
ea12371a01
1 changed files with 5 additions and 5 deletions
|
@ -141,11 +141,11 @@ def fix_actor(%{"attributedTo" => actor} = object) do
|
||||||
|> Map.put("actor", get_actor(%{"actor" => actor}))
|
|> Map.put("actor", get_actor(%{"actor" => actor}))
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_likes(%{"likes" => likes} = object)
|
|
||||||
when is_bitstring(likes) do
|
|
||||||
# Check for standardisation
|
# Check for standardisation
|
||||||
# This is what Peertube does
|
# This is what Peertube does
|
||||||
# curl -H 'Accept: application/activity+json' $likes | jq .totalItems
|
# curl -H 'Accept: application/activity+json' $likes | jq .totalItems
|
||||||
|
# Prismo returns only an integer (count) as "likes"
|
||||||
|
def fix_likes(%{"likes" => likes} = object) when not is_map(likes) do
|
||||||
object
|
object
|
||||||
|> Map.put("likes", [])
|
|> Map.put("likes", [])
|
||||||
|> Map.put("like_count", 0)
|
|> Map.put("like_count", 0)
|
||||||
|
|
Loading…
Reference in a new issue