Skip to content

server: Set reply sorting to 'oldest'#1035

Merged
jelmer merged 4 commits into
isso-comments:masterfrom
ggtylerr:master
Aug 14, 2025
Merged

server: Set reply sorting to 'oldest'#1035
jelmer merged 4 commits into
isso-comments:masterfrom
ggtylerr:master

Conversation

@ggtylerr
Copy link
Copy Markdown
Contributor

@ggtylerr ggtylerr commented Aug 24, 2024

Checklist

  • All new and existing tests are passing
  • (If adding features:) I have added tests to cover my changes
  • (If docs changes needed:) I have updated the documentation accordingly.
  • I have added an entry to CHANGES.rst because this is a user-facing change or an important bugfix
  • I have written proper commit message(s)

What changes does this Pull Request introduce?

Quick SQL patch to fix #1026

Why is this necessary?

Current reply sorting leads to confusion. See linked issue for details.

NOTE: I tested this briefly and it seems to be working (and of course unit tests pass) but I wasn't sure if the sorting option was actually going through. Hard to tell on the demo page. Will probably test tmrw over curl.

Copy link
Copy Markdown
Member

@ix5 ix5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you for the quick patch! Left a few inline comments, mainly regarding the usage of comments.id for sorting which I'd prefer you switch to comments.created for consistency.

Comment thread isso/db/comments.py Outdated
Comment thread isso/db/comments.py Outdated
Comment thread isso/db/comments.py Outdated
Comment thread isso/db/comments.py Outdated
@ggtylerr
Copy link
Copy Markdown
Contributor Author

ggtylerr commented Sep 5, 2024

Just confirmed the patch to be working now - you can see the results on my site. Here's the comment I showed as an example last time:
image

@ix5
Copy link
Copy Markdown
Member

ix5 commented Sep 9, 2024

Thank you for addressing the feedback. Please squash your commits and give the resulting commit a more descriptive title/body, such as db: Set reply sorting to 'oldest'.

You also checked in an updated package-lock.json to your commit when you didn't mean to, please remove that as well.

@ix5 ix5 changed the title Quick SQL patch to fix reply sorting server: Set reply sorting to 'oldest' Sep 9, 2024
@ix5 ix5 mentioned this pull request Sep 9, 2024
5 tasks
@ggtylerr
Copy link
Copy Markdown
Contributor Author

Fixed up as requested

@Kerumen
Copy link
Copy Markdown

Kerumen commented Oct 26, 2024

@ix5 do you plan to merge and release this? Thanks 🙏🏻

@ix5 ix5 added server (Python) server code improvement Not a new feature, but makes Isso more pleasant to use labels Apr 12, 2025
@ix5 ix5 added this to the 0.13.1 milestone Apr 12, 2025
@ix5
Copy link
Copy Markdown
Member

ix5 commented Apr 12, 2025

Sorry for leaving this in limbo for so long.
The test suite (predictably) fails for me:

FAILED isso/tests/test_comments.py::TestComments::testFeed - AssertionError: '"1-1"' != '"1-2"'
FAILED isso/tests/test_comments.py::TestComments::testGetSortedByNewestWithNested - AssertionError: Lists differ: [2, 3, 4, 5, 6] != [6, 5, 4, 3, 2]
FAILED isso/tests/test_comments.py::TestComments::testGetSortedByUpvotesWithNested - AssertionError: Lists differ: [2, 3, 4, 5, 6] != [6, 3, 2, 4, 5]

@ggtylerr would you mind updating the tests to reflect the new sorting? Thank you!

@jelmer
Copy link
Copy Markdown
Member

jelmer commented Jul 25, 2025

Hi @ggtylerr any news on this?

@ggtylerr
Copy link
Copy Markdown
Contributor Author

Hi, sorry, I didn't get any notification for this when ix5 replied for some reason. I'll update it whenever I'm off my shift today.

@ggtylerr
Copy link
Copy Markdown
Contributor Author

ggtylerr commented Jul 26, 2025

I fetched upstream, cleared the merge conflict and updated the tests. Everything seems to work when I run it with nektos act, although I can't run isso itself since pip isn't letting me pull misaka.

One thing to note is that testGetSortedByNewestWithNested and testGetSortedByUpvotesWithNested now have the same order, due to them testing for the order of replies and not comments + replies. I consider this fine and these two still test whether or not the reply order is modified, but it's still something to note. Might need to modify to test that, or just have a separate test.

(Also I cannot for the life of me figure out how to squash nicely w/ the merge commit, I'm sorry 😢)

@jelmer jelmer requested review from Copilot, ix5 and jelmer July 27, 2025 08:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR changes the default sorting behavior for comment replies to always use "oldest first" ordering, addressing user confusion about reply sorting inconsistencies. The change affects both the database query logic and client-side behavior.

Key changes:

  • Modified SQL queries to force replies to always sort by creation time in ascending order
  • Updated tests to reflect the new oldest-first reply ordering
  • Added documentation noting that replies are always sorted oldest-first as of version 0.13.1

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
isso/db/comments.py Modified SQL ORDER BY clauses to ensure replies are always sorted by creation time
isso/tests/test_comments.py Updated test expectations to match new oldest-first reply sorting behavior
docs/docs/reference/client-config.rst Added documentation note about forced oldest-first reply sorting
CHANGES.rst Added changelog entry for the reply sorting fix

Comment thread isso/db/comments.py
Comment thread isso/db/comments.py
Comment thread isso/db/comments.py
@jelmer
Copy link
Copy Markdown
Member

jelmer commented Jul 27, 2025

LGTM. I'll wait a few days to give @ix5 a chance to object. I'll merge otherwise.

@jelmer jelmer merged commit 60ec890 into isso-comments:master Aug 14, 2025
18 checks passed
@Kerumen
Copy link
Copy Markdown

Kerumen commented Aug 16, 2025

@jelmer Do you plan to cut a release including this change?

@jelmer
Copy link
Copy Markdown
Member

jelmer commented Aug 16, 2025

We should do another release at some point; first we should fix the failing tests though.

@ix5
Copy link
Copy Markdown
Member

ix5 commented Aug 18, 2025

Sorry for the late reply, updated PR now LGTM.

@ggtylerr you can do a rebase including a squash of superfluous merge/editing commits, that's the way I'd recommend at least.

@ggtylerr
Copy link
Copy Markdown
Contributor Author

@ggtylerr you can do a rebase including a squash of superfluous merge/editing commits, that's the way I'd recommend at least.

It's uh, already merged though 😅 I probably should've said to just use the squash + merge option in GH before it got merged, but it's whatever

@ix5
Copy link
Copy Markdown
Member

ix5 commented Aug 24, 2025

It's uh, already merged though 😅 I probably should've said to just use the squash + merge option in GH before it got merged, but it's whatever

No worries, just format your updated commit history correctly next time. git rebase -i is a big help there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Not a new feature, but makes Isso more pleasant to use server (Python) server code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Separate sorting for replies

5 participants