From 2b08fe5be98ba1de0dc3c16f2f3f25ce3c2b262c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 27 Mar 2019 11:37:16 -0700 Subject: [PATCH] Adding correct comment ordering --- server/src/actions/comment.rs | 1 + ui/src/components/post.tsx | 15 ++++++++------- ui/src/main.css | 11 +++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/server/src/actions/comment.rs b/server/src/actions/comment.rs index ceedf2945..93e808a44 100644 --- a/server/src/actions/comment.rs +++ b/server/src/actions/comment.rs @@ -103,6 +103,7 @@ impl Comment { pub fn from_post(conn: &PgConnection, post: &Post) -> Result, Error> { use schema::community::dsl::*; Comment::belonging_to(post) + .order_by(comment::published.desc()) .load::(conn) } } diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx index 193da3de0..5e383c09c 100644 --- a/ui/src/components/post.tsx +++ b/ui/src/components/post.tsx @@ -131,7 +131,7 @@ export class Post extends Component { commentsTree() { let nodes = this.buildCommentsTree(); return ( -
+
); @@ -147,7 +147,7 @@ export class Post extends Component { } else if (op == UserOperation.GetPost) { let res: PostResponse = msg; this.state.post = res.post; - this.state.comments = res.comments.reverse(); + this.state.comments = res.comments; this.setState(this.state); } else if (op == UserOperation.CreateComment) { let res: CommentResponse = msg; @@ -177,10 +177,11 @@ export class CommentNodes extends Component {this.props.nodes.map(node => -
-
-
-
+
+
+
+
20
+
    @@ -189,7 +190,7 @@ export class CommentNodes extends Component
  • ( - 1300 + +1300 | -29 ) points diff --git a/ui/src/main.css b/ui/src/main.css index cb2d53d44..30fbc8dcc 100644 --- a/ui/src/main.css +++ b/ui/src/main.css @@ -1,3 +1,14 @@ + + + .pointer { cursor: pointer; } + +.upvote:hover { + color: var(--info); +} + +.downvote:hover { + color: var(--danger); +}