Skip to content

Fix undefined secondary sort for user posts breaking pagination#2013

Merged
ArtOfCode- merged 2 commits intodevelopfrom
0valt/2008/user-post-list-sort
Mar 12, 2026
Merged

Fix undefined secondary sort for user posts breaking pagination#2013
ArtOfCode- merged 2 commits intodevelopfrom
0valt/2008/user-post-list-sort

Conversation

@Oaphi
Copy link
Copy Markdown
Member

@Oaphi Oaphi commented Mar 11, 2026

closes #2008

This PR adds a secondary order by creation timestamp to user's posts (newest first) - this should be safe enough for 99.99% cases (creation timestamp collision is highly unlikely). In addition, the PR lays the groundwork for a proper action callback by making the logic for setting posts in the show and posts actions shared (that's as far as I am willing to go in scope for this particular fix).

@Oaphi Oaphi force-pushed the 0valt/2008/user-post-list-sort branch from c2029e7 to e2c2f6a Compare March 11, 2026 18:36
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.74%. Comparing base (4deef91) to head (7314863).
⚠️ Report is 5 commits behind head on develop.

Additional details and impacted files
Components Coverage Δ
controllers 75.86% <100.00%> (+<0.01%) ⬆️
helpers 85.06% <ø> (ø)
jobs 66.88% <ø> (ø)
models 93.01% <ø> (ø)
tasks 61.11% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Oaphi Oaphi requested review from a team, MoshiKoi, cellio and trichoplax March 11, 2026 18:49
@cellio
Copy link
Copy Markdown
Member

cellio commented Mar 11, 2026

This changed the number in the "see all" button on the profile from the true number back to 15 (for someone with more than 15, i.e. someone with pagination).

@Oaphi
Copy link
Copy Markdown
Member Author

Oaphi commented Mar 11, 2026

This changed the number in the "see all" button on the profile from the true number back to 15 (for someone with more than 15, i.e. someone with pagination).

ah, whoops, a sec

Comment thread app/controllers/users_controller.rb
@Oaphi Oaphi marked this pull request as draft March 11, 2026 20:48
@Oaphi Oaphi marked this pull request as ready for review March 11, 2026 22:07
@Oaphi Oaphi requested a review from cellio March 11, 2026 22:07
Copy link
Copy Markdown
Member

@cellio cellio left a comment

Choose a reason for hiding this comment

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

LGTM now; tested and it's behaving correctly. Thanks for adding the test.

@ArtOfCode- ArtOfCode- merged commit 325a32b into develop Mar 12, 2026
13 checks passed
@ArtOfCode- ArtOfCode- deleted the 0valt/2008/user-post-list-sort branch March 12, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A user's post list, when sorting by score, can have duplicate or missing entries.

3 participants