Browse Source

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.
merge-requests/19/head
Deimos 6 years ago
parent
commit
f3cd4f805e
  1. 2
      tildes/tildes/views/user.py

2
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,
)

Loading…
Cancel
Save