mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 15:05:45 +00:00
Transmogrifier: fix incoming objects with invalid likes
This commit is contained in:
parent
6383fa3a5d
commit
77f2137383
|
@ -141,11 +141,11 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
|> Map.put("actor", get_actor(%{"actor" => actor}))
|
|> Map.put("actor", get_actor(%{"actor" => actor}))
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix_likes(%{"likes" => likes} = object)
|
# Check for standardisation
|
||||||
when is_bitstring(likes) do
|
# This is what Peertube does
|
||||||
# Check for standardisation
|
# curl -H 'Accept: application/activity+json' $likes | jq .totalItems
|
||||||
# This is what Peertube does
|
# Prismo returns only an integer (count) as "likes"
|
||||||
# curl -H 'Accept: application/activity+json' $likes | jq .totalItems
|
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