fix(feed): correct Atom entry links

This commit is contained in:
Lain Soykaf 2026-07-24 20:38:25 +04:00
commit ecd8a14435
No known key found for this signature in database
4 changed files with 8 additions and 8 deletions

View file

@ -15,8 +15,7 @@
<summary><%= escape(@data["summary"]) %></summary>
<% end %>
<link type="application/atom+xml" href='<%= activity_link(@activity, @data) %>' rel="self"/>
<link type="text/html" href='<%= activity_link(@activity, @data) %>' rel="alternate"/>
<link type="text/html" href='<%= escape(activity_link(@activity, @data) || "") %>' rel="alternate"/>
<%= for tag <- Pleroma.Object.hashtags(@object) do %>
<category term="<%= tag %>"></category>

View file

@ -18,8 +18,7 @@
<summary><%= escape(@data["summary"]) %></summary>
<% end %>
<link type="application/atom+xml" href='<%= activity_link(@activity, @data) %>' rel="self"/>
<link type="text/html" href='<%= activity_link(@activity, @data) %>' rel="alternate"/>
<link type="text/html" href='<%= escape(activity_link(@activity, @data) || "") %>' rel="alternate"/>
<%= for tag <- Pleroma.Object.hashtags(@object) do %>
<category term="<%= tag %>"></category>

View file

@ -73,6 +73,8 @@ defmodule Pleroma.Web.Feed.TagControllerTest do
]
assert xpath(xml, ~x"//feed/entry/author/name/text()"ls) == [user.nickname, user.nickname]
assert xpath(xml, ~x"//feed/entry/link[@rel='self']/@href"sl) == []
assert length(xpath(xml, ~x"//feed/entry/link[@rel='alternate']/@href"sl)) == 2
assert xpath(xml, ~x"//feed/entry/link[@rel='enclosure']/@href"sl) == [
"https://peertube.moe/video.mp4?first=one&second=two",

View file

@ -83,12 +83,12 @@ defmodule Pleroma.Web.Feed.UserControllerTest do
|> get(user_feed_path(conn, :feed, user.nickname))
|> response(200)
activity_titles =
resp
|> SweetXml.parse()
|> SweetXml.xpath(~x"//entry/title/text()"l)
xml = SweetXml.parse(resp)
activity_titles = SweetXml.xpath(xml, ~x"//entry/title/text()"l)
assert activity_titles == [~c"Won't, didn'...", ~c"2hu", ~c"2hu & as"]
assert SweetXml.xpath(xml, ~x"//entry/link[@rel='self']/@href"sl) == []
assert length(SweetXml.xpath(xml, ~x"//entry/link[@rel='alternate']/@href"sl)) == 3
assert resp =~ FeedView.escape(object.data["content"])
assert resp =~ FeedView.escape(object.data["summary"])
assert resp =~ FeedView.escape(object.data["context"])