fix(feed): correct RSS permalink metadata
This commit is contained in:
parent
ecd8a14435
commit
c518319349
3 changed files with 37 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<item>
|
<item>
|
||||||
<activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
|
<activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
|
||||||
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
|
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
|
||||||
<guid isPermaLink="true"><%= @data["id"] %></guid>
|
<guid isPermaLink="true"><%= escape(@data["id"] || "") %></guid>
|
||||||
<title><%= activity_title(@data, Keyword.get(@feed_config, :post_title, %{})) %></title>
|
<title><%= activity_title(@data, Keyword.get(@feed_config, :post_title, %{})) %></title>
|
||||||
<description><%= activity_description(@data) %></description>
|
<description><%= activity_description(@data) %></description>
|
||||||
<content:encoded><![CDATA[<%= rss_content_encoded(@data) %>]]></content:encoded>
|
<content:encoded><![CDATA[<%= rss_content_encoded(@data) %>]]></content:encoded>
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<%= activity_context(@activity) %>
|
<%= activity_context(@activity) %>
|
||||||
</ostatus:conversation>
|
</ostatus:conversation>
|
||||||
|
|
||||||
<link><%= activity_link(@activity, @data) %></link>
|
<link><%= escape(activity_link(@activity, @data) || "") %></link>
|
||||||
|
|
||||||
<%= for tag <- Pleroma.Object.hashtags(@object) do %>
|
<%= for tag <- Pleroma.Object.hashtags(@object) do %>
|
||||||
<%= if tag && tag != "" do %>
|
<%= if tag && tag != "" do %>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<item>
|
<item>
|
||||||
<guid isPermalink="true"><%= activity_link(@activity, @data) %></guid>
|
<guid isPermaLink="true"><%= escape(activity_link(@activity, @data) || "") %></guid>
|
||||||
<link><%= activity_link(@activity, @data) %></link>
|
<link><%= escape(activity_link(@activity, @data) || "") %></link>
|
||||||
<pubDate><%= to_rfc2822(@data["published"]) %></pubDate>
|
<pubDate><%= to_rfc2822(@data["published"]) %></pubDate>
|
||||||
<title><%= activity_title(@data, Keyword.get(@feed_config, :post_title, %{})) %></title>
|
<title><%= activity_title(@data, Keyword.get(@feed_config, :post_title, %{})) %></title>
|
||||||
<description><%= activity_description(@data) %></description>
|
<description><%= activity_description(@data) %></description>
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,8 @@ defmodule Pleroma.Web.Feed.TagControllerTest do
|
||||||
~c"yeah #PleromaArt"
|
~c"yeah #PleromaArt"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
assert xpath(xml, ~x"//channel/item/guid/@isPermaLink"sl) == ["true", "true"]
|
||||||
|
|
||||||
assert xpath(xml, ~x"//channel/item/pubDate/text()"sl) == [
|
assert xpath(xml, ~x"//channel/item/pubDate/text()"sl) == [
|
||||||
FeedView.to_rfc2822(activity2.data["published"]),
|
FeedView.to_rfc2822(activity2.data["published"]),
|
||||||
FeedView.to_rfc2822(activity1.data["published"])
|
FeedView.to_rfc2822(activity1.data["published"])
|
||||||
|
|
@ -232,6 +234,37 @@ defmodule Pleroma.Web.Feed.TagControllerTest do
|
||||||
refute response =~ "<lastBuildDate>"
|
refute response =~ "<lastBuildDate>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "escapes and round-trips RSS item permalinks", %{conn: conn} do
|
||||||
|
user = insert(:user, local: false)
|
||||||
|
permalink = "https://remote.example/post?first=one&second=two"
|
||||||
|
|
||||||
|
note =
|
||||||
|
insert(:note,
|
||||||
|
user: user,
|
||||||
|
object_local: false,
|
||||||
|
data: %{
|
||||||
|
"content" => "remote #rsslink",
|
||||||
|
"external_url" => permalink,
|
||||||
|
"summary" => "",
|
||||||
|
"tag" => ["rsslink"]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
insert(:note_activity, user: user, note: note, local: false, object_local: false)
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> put_req_header("accept", "application/rss+xml")
|
||||||
|
|> get(tag_feed_path(conn, :feed, "rsslink.rss"))
|
||||||
|
|> response(200)
|
||||||
|
|
||||||
|
assert response =~ "https://remote.example/post?first=one&second=two"
|
||||||
|
|
||||||
|
xml = parse(response)
|
||||||
|
assert xpath(xml, ~x"//channel/item/guid/text()"s) == permalink
|
||||||
|
assert xpath(xml, ~x"//channel/item/link/text()"s) == permalink
|
||||||
|
end
|
||||||
|
|
||||||
describe "private instance" do
|
describe "private instance" do
|
||||||
setup do: clear_config([:instance, :public], false)
|
setup do: clear_config([:instance, :public], false)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue