remove pub_date() -- use to_rfc2822 instead

_tag_activity.xml.eex used activity_content() instead
of activity_description(), and did not escape html properly.
This commit is contained in:
faried nawaz 2022-11-15 23:42:54 +05:00
parent f597b1b3e6
commit 0f67eab384
No known key found for this signature in database
GPG key ID: C8EBC3669D3539B4
2 changed files with 2 additions and 11 deletions

View file

@ -17,15 +17,6 @@ defmodule Pleroma.Web.Feed.FeedView do
@days ~w(Mon Tue Wed Thu Fri Sat Sun) @days ~w(Mon Tue Wed Thu Fri Sat Sun)
@months ~w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) @months ~w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
@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: to_rfc2822(date)
def prepare_activity(activity, opts \\ []) do def prepare_activity(activity, opts \\ []) do
object = Object.normalize(activity, fetch: false) object = Object.normalize(activity, fetch: false)

View file

@ -4,9 +4,9 @@
<guid isPermalink="true"><%= activity_context(@activity) %></guid> <guid isPermalink="true"><%= activity_context(@activity) %></guid>
<link><%= activity_context(@activity) %></link> <link><%= activity_context(@activity) %></link>
<pubDate><%= pub_date(@activity.data["published"]) %></pubDate> <pubDate><%= to_rfc2822(@activity.data["published"]) %></pubDate>
<description><%= activity_content(@data) %></description> <description><%= activity_description(@data) %></description>
<%= for attachment <- @data["attachment"] || [] do %> <%= for attachment <- @data["attachment"] || [] do %>
<enclosure url="<%= attachment_href(attachment) %>" type="<%= attachment_type(attachment) %>"/> <enclosure url="<%= attachment_href(attachment) %>" type="<%= attachment_type(attachment) %>"/>
<% end %> <% end %>