Skip to content
Snippets Groups Projects
Commit d97eb8c6 authored by ArtOfCode-'s avatar ArtOfCode-
Browse files

Fix no-posts case for RSS feeds

parent 0f05bdee
Branches
Tags
No related merge requests found
...@@ -6,7 +6,7 @@ xml.feed xmlns: 'http://www.w3.org/2005/Atom' do ...@@ -6,7 +6,7 @@ xml.feed xmlns: 'http://www.w3.org/2005/Atom' do
xml.name "#{SiteSetting['SiteName']} - Codidact" xml.name "#{SiteSetting['SiteName']} - Codidact"
end end
xml.link nil, rel: 'self', href: category_url(@category) xml.link nil, rel: 'self', href: category_url(@category)
xml.updated @posts.maximum(:created_at).iso8601 xml.updated @posts.maximum(:created_at)&.iso8601 || RequestContext.community.created_at&.iso8601
@posts.each do |post| @posts.each do |post|
xml.entry do xml.entry do
...@@ -16,8 +16,8 @@ xml.feed xmlns: 'http://www.w3.org/2005/Atom' do ...@@ -16,8 +16,8 @@ xml.feed xmlns: 'http://www.w3.org/2005/Atom' do
xml.name post.user.username xml.name post.user.username
xml.uri user_url(post.user) xml.uri user_url(post.user)
end end
xml.published post.created_at.iso8601 xml.published post.created_at&.iso8601
xml.updated post.updated_at.iso8601 xml.updated post.updated_at&.iso8601
xml.link href: question_path(post) xml.link href: question_path(post)
xml.summary post.body.truncate(200), type: 'html' xml.summary post.body.truncate(200), type: 'html'
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment