From 971bb4f2bde125c1f8397c244a6fbdec0d26716b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 24 Jun 2018 06:34:44 +0000 Subject: [PATCH] activity interpretation: formatting --- lib/pleroma/web/activity_pub/transmogrifier.ex | 3 ++- lib/pleroma/web/mastodon_api/views/status_view.ex | 1 + lib/pleroma/web/twitter_api/views/activity_view.ex | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 1b60170d9..59c4b90e7 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -122,7 +122,8 @@ def fix_content_map(object), do: object # 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"]) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index f7ad87bad..6b48c41c1 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -210,6 +210,7 @@ def get_visibility(object) do def render_content(%{"type" => "Article"} = object) do summary = object["name"] + content = if !!summary and summary != "" do "

#{summary}

#{object["content"]}" diff --git a/lib/pleroma/web/twitter_api/views/activity_view.ex b/lib/pleroma/web/twitter_api/views/activity_view.ex index 0779872fe..f418249e2 100644 --- a/lib/pleroma/web/twitter_api/views/activity_view.ex +++ b/lib/pleroma/web/twitter_api/views/activity_view.ex @@ -261,6 +261,7 @@ def render( def render_content(%{"type" => "Note"} = object) do summary = object["summary"] + content = if !!summary and summary != "" do "

#{summary}

#{object["content"]}" @@ -273,6 +274,7 @@ def render_content(%{"type" => "Note"} = object) do def render_content(%{"type" => "Article"} = object) do summary = object["name"] || object["summary"] + content = if !!summary and summary != "" do "

#{summary}

#{object["content"]}"