Skip to content

feat(timeline): configurable message grouping threshold#819

Open
Just-Insane wants to merge 4 commits into
SableClient:devfrom
Just-Insane:feat/message-grouping
Open

feat(timeline): configurable message grouping threshold#819
Just-Insane wants to merge 4 commits into
SableClient:devfrom
Just-Insane:feat/message-grouping

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

@Just-Insane Just-Insane commented May 14, 2026

Description

Exposes the message grouping time threshold as a user-configurable setting. Messages sent within the threshold window by the same sender are visually grouped (compact, no repeated avatar/name). Users can now adjust this window to taste or disable grouping entirely.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Fully AI generated (explain what all the generated code does in moderate detail).
  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).

A messageGroupingThresholdMs setting key was added to the settings schema with a default matching the previous hardcoded value. The appearance settings panel gained a number input bound to that key. The timeline renderer reads the setting instead of the constant and uses it in the same-group comparison that decides whether to render a compact or full message row. Setting the value to 0 effectively disables grouping.

Just-Insane and others added 2 commits May 14, 2026 15:40
Add Discord-style message grouping where consecutive messages from the
same sender within a configurable time window collapse the sender header.

- Add messageGroupingThreshold to Settings type (default: 2 min)
- Replace hardcoded 2-min threshold in useProcessedTimeline with the setting
- Wire useSetting in RoomTimeline and pass to useProcessedTimeline
- Add MessageGrouping component in Experimental settings with 5 options:
  2 min (default), 5 min, 15 min (Discord-style), 30 min, 60 min

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Just-Insane Just-Insane force-pushed the feat/message-grouping branch from 2f48d48 to 44ef75c Compare May 14, 2026 19:40
@Just-Insane Just-Insane marked this pull request as ready for review May 19, 2026 23:16
@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners May 19, 2026 23:16
Copilot AI review requested due to automatic review settings May 19, 2026 23:16
Copy link
Copy Markdown
Contributor

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 makes the timeline’s “consecutive message grouping” time window configurable via a new user setting, replacing the previously hardcoded 2-minute threshold.

Changes:

  • Adds a new messageGroupingThreshold setting (default 2) to persisted settings.
  • Threads the threshold through RoomTimeline into useProcessedTimeline, and uses it in the “same group” collapse decision.
  • Adds an Experimental settings UI entry to adjust the threshold, plus a small refactor in RoomTimeline to avoid toReversed().find(...).

Reviewed changes

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

Show a summary per file
File Description
src/app/state/settings.ts Adds the new persisted setting and its default.
src/app/hooks/timeline/useProcessedTimeline.ts Introduces an option for the grouping threshold and applies it in collapse logic.
src/app/features/settings/experimental/MessageGrouping.tsx New settings UI control for selecting a grouping threshold.
src/app/features/settings/experimental/Experimental.tsx Wires the new Message Grouping tile into the Experimental settings page.
src/app/features/room/RoomTimeline.tsx Reads the setting, passes it into timeline processing, and refactors “edit last message” lookup.
.changeset/message-grouping.md Adds a release note entry for the new feature.
Comments suppressed due to low confidence (1)

src/app/state/settings.ts:310

  • This setting is used in a time comparison, but it currently relies on the generic “finite number” sanitizer, which allows negative values and non-integers. That can lead to surprising behavior (e.g., negative values effectively disable grouping) and values that the UI <select> can’t represent. Consider adding a dedicated sanitizer/migration for messageGroupingThreshold (e.g., integer minutes, minimum 0, and optionally an upper bound).
  // experimental
  messageGroupingThreshold: 2,
  // furry stuff

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to +14
const THRESHOLD_OPTIONS: { value: number; label: string }[] = [
{ value: 2, label: '2 min (default)' },
{ value: 5, label: '5 min' },
{ value: 15, label: '15 min (Discord-style)' },
{ value: 30, label: '30 min' },
{ value: 60, label: '60 min' },
];
Comment on lines +31 to +34
* full user header. Defaults to 2 (the original behaviour). Set higher
* (e.g. 15) for Discord-style compact grouping.
*/
messageGroupingThreshold?: number;
Comment thread src/app/state/settings.ts
Comment on lines +173 to +175
// experimental
messageGroupingThreshold: number;

- Add 'Off (no grouping)' option (value 0) to threshold select so users
  can disable grouping; unknown/custom values now have a valid fallback
- Make messageGroupingThreshold required in UseProcessedTimelineOptions
  to force all callers to explicitly pass the user setting
- Plumb messageGroupingThreshold through ThreadDrawer.tsx so thread
  timelines respect the same grouping setting as the main timeline
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.

2 participants