summary refs log tree commit diff stats
path: root/pkgs/by-name/ba/back/src/web/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ba/back/src/web/mod.rs')
-rw-r--r--pkgs/by-name/ba/back/src/web/mod.rs27
1 files changed, 26 insertions, 1 deletions
diff --git a/pkgs/by-name/ba/back/src/web/mod.rs b/pkgs/by-name/ba/back/src/web/mod.rs
index 968c827..f7a4077 100644
--- a/pkgs/by-name/ba/back/src/web/mod.rs
+++ b/pkgs/by-name/ba/back/src/web/mod.rs
@@ -110,7 +110,8 @@ pub fn closed(config: &State<BackConfig>) -> error::Result<RawHtml<String>> {
 pub fn feed(config: &State<BackConfig>) -> error::Result<RawHtml<String>> {
     use rss::{ChannelBuilder, Item, ItemBuilder};
 
-    let items: Vec<Item> = issues_from_repository(&config.repository.to_thread_local())?
+    //Collect all Items as rss items
+    let mut items: Vec<Item> = issues_from_repository(&config.repository.to_thread_local())?
         .into_iter()
         .map(|issue| issue.collapse())
         .map(|issue| {
@@ -123,6 +124,30 @@ pub fn feed(config: &State<BackConfig>) -> error::Result<RawHtml<String>> {
                 .build()
         })
         .collect();
+    //Append all comments after converting them to rss items
+    items.extend(
+        issues_from_repository(&config.repository.to_thread_local())?
+            .into_iter()
+            .map(|issue| issue.collapse())
+            .filter(|issue| issue.comments.len() > 0)
+            .map(|issue| {
+                issue
+                    .comments
+                    .into_iter()
+                    .map(|comment| {
+                        ItemBuilder::default()
+                            .title(issue.title.to_string())
+                            .author(comment.author.to_string())
+                            .description(comment.message.to_string())
+                            .pub_date(comment.timestamp.to_string())
+                            .link(format!("{}/issue/{}", &config.root.to_string(), issue.id))
+                            .build()
+                    })
+                    .collect::<Vec<Item>>()
+            })
+            .flatten()
+            .collect::<Vec<Item>>(),
+    );
 
     let channel = ChannelBuilder::default()
         .title("Issues")