- defp conversation_id(activity) do
- with context when not is_nil(context) <- activity.data["context"] do
- TwitterAPI.context_to_conversation_id(context)
- else
- _e -> nil
- end
+ def render("activity.json", %{activity: unhandled_activity}) do
+ Logger.warn("#{__MODULE__} unhandled activity: #{inspect(unhandled_activity)}")
+ nil
+ end
+
+ def render_content(%{"type" => "Note"} = object) do
+ summary = object["summary"]
+
+ content =
+ if !!summary and summary != "" do
+ "<p>#{summary}</p>#{object["content"]}"
+ else
+ object["content"]
+ end
+
+ {summary, content}
+ end
+
+ def render_content(%{"type" => object_type} = object)
+ when object_type in ["Article", "Page", "Video"] do
+ summary = object["name"] || object["summary"]
+
+ content =
+ if !!summary and summary != "" and is_bitstring(object["url"]) do
+ "<p><a href=\"#{object["url"]}\">#{summary}</a></p>#{object["content"]}"
+ else
+ object["content"]
+ end
+
+ {summary, content}
+ end
+
+ def render_content(object) do
+ summary = object["summary"] || "Unhandled activity type: #{object["type"]}"
+ content = "<p>#{summary}</p>#{object["content"]}"
+
+ {summary, content}