about summary refs log tree commit diff
path: root/src/render.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/render.rs')
-rw-r--r--src/render.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/render.rs b/src/render.rs
index 37f1c4b7fe60..f47830fa847e 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -101,24 +101,15 @@ fn md5_hex(input: &[u8]) -> String {
 }
 
 fn prepare_thread(comrak: &ComrakOptions, page: ThreadPage) -> RenderableThreadPage {
-    let mut posts = vec![RenderablePost {
-        // Always pin the ID of the first post.
-        id: 0,
-        body: markdown_to_html(&page.thread.body, comrak),
-        posted: page.thread.posted.into(),
-        author_name: page.thread.author_name,
-        author_gravatar: md5_hex(page.thread.author_email.as_bytes()),
-    }];
-
-    for post in page.posts {
-        posts.push(RenderablePost {
+    let posts = page.posts.into_iter().map(|post| {
+        RenderablePost {
             id: post.id,
             body: markdown_to_html(&post.body, comrak),
             posted: post.posted.into(),
             author_name: post.author_name,
             author_gravatar: md5_hex(post.author_email.as_bytes()),
-        });
-    }
+        }
+    }).collect();
 
     RenderableThreadPage {
         posts,