1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Feed.FeedView do
11 alias Pleroma.Web.MediaProxy
13 require Pleroma.Constants
15 def most_recent_update(activities, user) do
16 (List.first(activities) || user).updated_at
17 |> NaiveDateTime.to_iso8601()
26 def last_activity(activities) do
30 def activity_object(activity) do
31 Object.normalize(activity)
34 def activity_object_data(activity) do
40 def activity_content(activity) do
41 content = activity_object_data(activity)["content"]
44 |> String.replace(~r/[\n\r]/, "")
48 def activity_context(activity) do
49 activity.data["context"]
52 def attachment_href(attachment) do
58 def attachment_type(attachment) do
61 |> Map.get("mediaType")
65 with %Object{data: %{"external_url" => external_url}} <- Object.get_cached_by_ap_id(id) do