# TODO: validate those with a Ecto scheme
# - tags
# - emoji
- def handle_incoming(%{"type" => "Create", "object" => %{"type" => objtype} = object} = data) when objtype in ["Article", "Note"] do
+ def handle_incoming(%{"type" => "Create", "object" => %{"type" => objtype} = object} = data)
+ when objtype in ["Article", "Note"] do
with nil <- Activity.get_create_activity_by_object_ap_id(object["id"]),
%User{} = user <- User.get_or_fetch_by_ap_id(data["actor"]) do
object = fix_object(data["object"])
def render_content(%{"type" => "Note"} = object) do
summary = object["summary"]
+
content =
if !!summary and summary != "" do
"<p>#{summary}</p>#{object["content"]}"
def render_content(%{"type" => "Article"} = object) do
summary = object["name"] || object["summary"]
+
content =
if !!summary and summary != "" do
"<p><a href=\"#{object["url"]}\">#{summary}</a></p>#{object["content"]}"