check if remote bday is valid

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-01-19 17:19:28 +01:00
parent dfb2808535
commit c180f9276f

View file

@ -1501,6 +1501,16 @@ defp object_to_user_data(data) do
nil
end
birth_date =
if data["vcard:bday"] do
case Date.from_iso8601(data["vcard:bday"]) do
{:ok, date} -> date
{:error, _} -> nil
end
else
nil
end
user_data = %{
ap_id: data["id"],
uri: get_actor_url(data["url"]),
@ -1524,7 +1534,7 @@ defp object_to_user_data(data) do
shared_inbox: shared_inbox,
accepts_chat_messages: accepts_chat_messages,
pinned_objects: pinned_objects,
birth_date: data["vcard:bday"]
birth_date: birth_date
}
# nickname can be nil because of virtual actors