summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcin mikołajczak <git@mkljczk.pl>2022-01-19 17:19:28 +0100
committermarcin mikołajczak <git@mkljczk.pl>2022-01-19 17:19:28 +0100
commitc180f9276fe9c6d6e7c5d25165bf87606cd1c966 (patch)
tree90b3856d1388ff06cdd1530dde311c57bcc27d87
parentdfb28085356aea63c2b0c755d7861946315c3931 (diff)
check if remote bday is valid
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index 837f4b82a..e1f94ba9c 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -1501,6 +1501,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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