From 2cf3861931806259264a122cca381c890226740c Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 24 Mar 2024 07:08:59 +0300 Subject: [PATCH] Replace collection partial with single item in changeset comments feed --- .../changeset_comments/_comment.rss.builder | 14 ++++++++++++++ .../changeset_comments/_comments.rss.builder | 16 ---------------- app/views/changeset_comments/index.rss.builder | 2 +- 3 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 app/views/changeset_comments/_comment.rss.builder delete mode 100644 app/views/changeset_comments/_comments.rss.builder diff --git a/app/views/changeset_comments/_comment.rss.builder b/app/views/changeset_comments/_comment.rss.builder new file mode 100644 index 000000000..83dfadda8 --- /dev/null +++ b/app/views/changeset_comments/_comment.rss.builder @@ -0,0 +1,14 @@ +xml.item do + xml.title t(".comment", :author => comment.author.display_name, :changeset_id => comment.changeset.id.to_s) + + xml.link changeset_url(comment.changeset, :anchor => "c#{comment.id}") + xml.guid changeset_url(comment.changeset, :anchor => "c#{comment.id}") + + xml.description do + xml.cdata! render(:partial => "comment", :object => comment, :formats => [:html]) + end + + xml.dc :creator, comment.author.display_name if comment.author + + xml.pubDate comment.created_at.to_fs(:rfc822) +end diff --git a/app/views/changeset_comments/_comments.rss.builder b/app/views/changeset_comments/_comments.rss.builder deleted file mode 100644 index b1344b488..000000000 --- a/app/views/changeset_comments/_comments.rss.builder +++ /dev/null @@ -1,16 +0,0 @@ -comments.each do |comment| - xml.item do - xml.title t(".comment", :author => comment.author.display_name, :changeset_id => comment.changeset.id.to_s) - - xml.link changeset_url(comment.changeset, :anchor => "c#{comment.id}") - xml.guid changeset_url(comment.changeset, :anchor => "c#{comment.id}") - - xml.description do - xml.cdata! render(:partial => "comment", :object => comment, :formats => [:html]) - end - - xml.dc :creator, comment.author.display_name if comment.author - - xml.pubDate comment.created_at.to_fs(:rfc822) - end -end diff --git a/app/views/changeset_comments/index.rss.builder b/app/views/changeset_comments/index.rss.builder index acaa54727..f055c2014 100644 --- a/app/views/changeset_comments/index.rss.builder +++ b/app/views/changeset_comments/index.rss.builder @@ -8,6 +8,6 @@ xml.rss("version" => "2.0", end xml.link url_for(:controller => "site", :action => "index", :only_path => false) - xml << render(:partial => "comments", :object => @comments) + xml << render(:partial => "comment", :collection => @comments) end end -- 2.39.5