summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/posts.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/views/posts.rs b/src/views/posts.rs
index 2ce69f8..82b5996 100644
--- a/src/views/posts.rs
+++ b/src/views/posts.rs
@@ -10,8 +10,9 @@ pub struct PostsView<P: Post> {
impl<P: Post> PostsView<P> {
pub fn with_posts(posts: impl IntoIterator<Item = P>) -> Self {
- Self {
- posts: posts.into_iter().collect(),
- }
+ let mut posts: Vec<P> = posts.into_iter().collect();
+ posts.sort();
+ posts.reverse();
+ Self { posts }
}
}