add tag feeds
This commit is contained in:
parent
a879c396bb
commit
b53573a837
9 changed files with 149 additions and 33 deletions
|
|
@ -13,6 +13,15 @@ defmodule Pleroma.Web.Feed.FeedView do
|
|||
|
||||
require Pleroma.Constants
|
||||
|
||||
@spec pub_date(String.t() | DateTime.t()) :: String.t()
|
||||
def pub_date(date) when is_binary(date) do
|
||||
date
|
||||
|> Timex.parse!("{ISO:Extended}")
|
||||
|> pub_date
|
||||
end
|
||||
|
||||
def pub_date(%DateTime{} = date), do: Timex.format!(date, "{RFC822}")
|
||||
|
||||
def prepare_activity(activity) do
|
||||
object = activity_object(activity)
|
||||
|
||||
|
|
@ -28,6 +37,17 @@ defmodule Pleroma.Web.Feed.FeedView do
|
|||
|> NaiveDateTime.to_iso8601()
|
||||
end
|
||||
|
||||
def feed_logo do
|
||||
case Pleroma.Config.get([:feed, :logo]) do
|
||||
nil ->
|
||||
"#{Pleroma.Web.base_url()}/static/logo.png"
|
||||
|
||||
logo ->
|
||||
"#{Pleroma.Web.base_url()}#{logo}"
|
||||
end
|
||||
|> MediaProxy.url()
|
||||
end
|
||||
|
||||
def logo(user) do
|
||||
user
|
||||
|> User.avatar_url()
|
||||
|
|
@ -40,6 +60,8 @@ defmodule Pleroma.Web.Feed.FeedView do
|
|||
|
||||
def activity_title(%{data: %{"content" => content}}, opts \\ %{}) do
|
||||
content
|
||||
|> Pleroma.Web.Metadata.Utils.scrub_html()
|
||||
|> Pleroma.Emoji.Formatter.demojify()
|
||||
|> Formatter.truncate(opts[:max_length], opts[:omission])
|
||||
|> escape()
|
||||
end
|
||||
|
|
@ -50,6 +72,8 @@ defmodule Pleroma.Web.Feed.FeedView do
|
|||
|> escape()
|
||||
end
|
||||
|
||||
def activity_content(_), do: ""
|
||||
|
||||
def activity_context(activity), do: activity.data["context"]
|
||||
|
||||
def attachment_href(attachment) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue