Skip to content

feat(dm-list): show last-message preview below room name#666

Closed
Just-Insane wants to merge 6 commits intoSableClient:devfrom
Just-Insane:feat/dm-message-preview
Closed

feat(dm-list): show last-message preview below room name#666
Just-Insane wants to merge 6 commits intoSableClient:devfrom
Just-Insane:feat/dm-message-preview

Conversation

@Just-Insane
Copy link
Copy Markdown
Contributor

@Just-Insane Just-Insane commented Apr 12, 2026

Description

Adds a real-time last-message preview (most recent non-state, non-reaction event) to each DM room entry in the sidebar, mirroring what most messaging clients show in their room list.

Commits in this PR:

  1. feat(dm-list): add toggle to hide DM message preview — adds the feature and a Visual Tweaks toggle to disable it. The preview renders the latest timeline event using a format suited to each content type (text, attachment, sticker, poll, etc.) and avoids re-rendering unless the relevant timeline events or atoms actually change.

  2. feat(dm-list): prefix message preview with sender display name — prepends the sender's display name to the preview string (e.g. "Alice: Hello!") so the conversation thread is clearer at a glance without opening the room.

  3. fix(settings): give DM Message Preview its own card in Visual Tweaks — moves the toggle into its own dedicated settings card so it doesn't get visually buried with unrelated options.

  4. fix(dm-list): update message preview immediately on event decryption — subscribes to MatrixEventEvent.Decrypted so the preview Updates the moment an encrypted event is decrypted, preventing a stale "Encrypted message" placeholder from lingering after decryption.

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:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).

The useRoomLastMessage hook's reverse-scan loop, the content-type dispatch table, and the MatrixEventEvent.Decrypted listener pattern were drafted with AI assistance and reviewed against the Matrix JS SDK documentation and existing hook patterns in the codebase. The settings card restructuring and sender-prefix logic were written manually.

@Just-Insane Just-Insane requested review from 7w1 and hazre as code owners April 12, 2026 03:19
@nushea
Copy link
Copy Markdown
Contributor

nushea commented Apr 12, 2026

i think maybe this should be a setting (and maybe, if the message is undecrypted it should fall-back to the status)

@Just-Insane
Copy link
Copy Markdown
Contributor Author

i think maybe this should be a setting (and maybe, if the message is undecrypted it should fall-back to the status)

It is a toggle-able setting, and if the setting to show the room description is enabled, it overrides the message preview.

@Just-Insane Just-Insane deleted the feat/dm-message-preview branch April 14, 2026 02:40
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