Skip to content

Conversation

@tessalt
Copy link
Contributor

@tessalt tessalt commented Oct 8, 2025

Collapse First-Level Replies by Default

Adds a new tenant setting to collapse first-level replies in the comment stream by default, giving moderators control over the initial display density of threaded conversations.

Changes

Server

  • Add collapseReplies boolean setting to tenant configuration
  • Add GraphQL schema field for the new setting

Admin

  • Add "Collapse Replies" configuration toggle in General settings
  • When enabled, top-level replies (depth 1) default to collapsed state

Client

  • Refactor CollapsableComment to use local GraphQL store for persistence
  • Track user toggles in collapsedCommentSettings (stores comment IDs toggled opposite to default)
  • Comments that are manually expanded/collapsed maintain their state within the session
  • Newly created comments always render expanded regardless of tenant setting

Behavior

  • Setting OFF (default): First-level replies display expanded (existing behavior)
  • Setting ON: First-level replies display collapsed, users can expand individually
  • toggle states persist on scroll (this is a change from previous behaviour)

These changes will impact:

  • commenters
  • moderators
  • admins
  • developers

What changes to the GraphQL/Database Schema does this PR introduce?

Does this PR introduce any new environment variables or feature flags?

If any indexes were added, were they added to INDEXES.md?

How do I test this PR?

  • Turn on the setting in General > Collapse Replies
  • Go to a stream with threaded comments, observe that the first level of replies is collapsed.
  • open up a thread, and see that further nested comments are not collapsed
  • scroll down and back, see that the state you recently set is maintained
  • reply to a top-level comment, see that the new comment is visible

Were any tests migrated to React Testing Library?

How do we deploy this PR?

@netlify
Copy link

netlify bot commented Oct 8, 2025

Deploy Preview for gallant-galileo-14878c canceled.

Name Link
🔨 Latest commit bd1936d
🔍 Latest deploy log https://app.netlify.com/projects/gallant-galileo-14878c/deploys/68f1281c5c52430008224123

@kabeaty kabeaty self-requested a review October 16, 2025 14:57
Copy link
Contributor

@kabeaty kabeaty left a comment

Choose a reason for hiding this comment

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

Looks good overall! The maintaining collapsed/expanded state on scroll is definitely a nice improvement.

I left a few small comments throughout. My main question is if we want to update so that it's possible to expand/collapse new replies after they have initially loaded in if the user who added the replies clicks on the expand/collapse.


const collapsed = useMemo(() => {
// If comment was just created, always show un-collapsed
if (isNewlyCreated) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This check means that until a user reloads the stream, they cannot collapse their new reply. I'm not sure how often someone would want to do that, but the new comment does show an expand/collapse option still, so it could be a bit confusing that it won't collapse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah interesting. I'm not suuure I care but I'll play around with it for a few minutes. good catch.

@nick-funk nick-funk self-requested a review October 28, 2025 17:03
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.

3 participants