Sidebar crashes when user has 20+ direct conversations #191
ESH13
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug
find_direct_placeholder_usersinUsers::SidebarsControllerpasses a negative value to.limit()when a user has direct rooms with 20 or more unique participants.Steps to reproduce
Expected behavior
Sidebar renders normally, with no direct placeholder users shown.
Actual behavior
PostgreSQL raises
LIMIT must not be negative, crashing the sidebar controller. Since the sidebar is loaded via a Turbo Frame on every page, the user sees "Content missing" on every page, every browser, every device. The application is completely unusable for that user.Cause
DIRECT_PLACEHOLDERSis 20.exclude_user_idsincludes all unique users in the user's direct rooms plus the user themselves. When that count exceeds 20,DIRECT_PLACEHOLDERS - exclude_user_ids.countgoes negative.Fix
Clamp the limit to a minimum of zero so
limit(0)returns an empty result set instead of raising. One-line change — happy to open a PR.Beta Was this translation helpful? Give feedback.
All reactions