From f3cd4f805ed787b95703c6e4911977378fef775a Mon Sep 17 00:00:00 2001 From: Deimos Date: Mon, 30 Jul 2018 23:40:06 -0600 Subject: [PATCH] User profile: fix ordering of "initial comments" When you're posting a new topic and you fill out both the link and text fields, it posts as a link topic with the text posted as the first comment. Because this is done in the same database transaction, the link and comment get exactly the same `created_time` value. Previously, the comment was being sorted "before" the topic, which was a bit confusing when viewing a user's profile - it would show the comment as being posted before the topic it was posted on. This just reverses the order that the two lists are joined in to fix this slight oddity. --- tildes/tildes/views/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tildes/tildes/views/user.py b/tildes/tildes/views/user.py index 220a4d4..f5ced8a 100644 --- a/tildes/tildes/views/user.py +++ b/tildes/tildes/views/user.py @@ -48,7 +48,7 @@ def get_user(request: Request) -> dict: topics = query.all() merged_posts = sorted( - topics + comments, + comments + topics, # this order so topic comes first when times match key=lambda post: post.created_time, reverse=True, )