feat(room): per-room "Show link previews" toggle (#493) #494

Merged
jared merged 1 commits from feat/room-link-previews-493 into lotus 2026-11-25 13:05:21 -05:00
Owner

Closes #493.

Why: rooms that post nothing but links, like World News RSS, fill the timeline with preview cards. The only fix was turning link previews off in every room.

What: Room settings → General → Display → Show link previews.

  • It affects only this room, and only the person who sets it.
  • It's saved as the standard org.matrix.room.preview_urls room account data ({ "disable": true }). That's the same event Element reads, so the choice syncs across devices and also applies in Element.
  • The room's choice wins over the global switches. If a room has no choice, the global setting applies as before (the encrypted-room switch for encrypted rooms).
  • When a room has a choice saved, a Use global setting button saves {} to go back to following the global setting.
  • Applies to the room timeline and to threads in that room. Links stay clickable; only the preview cards are hidden.

Files:

  • utils/roomUrlPreview.ts: pure resolver, with tests.
  • hooks/useRoomUrlPreview.ts: live hook that updates when the account data changes on any device.
  • room-settings/general/RoomLinkPreviews.tsx: the switch. It shows the new value right away and reverts if saving fails.
  • RoomTimeline and ThreadTimeline now use the hook.

Checks:

  • npm test: 1480 pass, 0 fail (4 new).
  • tsc: no new errors (the same 5 baseline errors in unrelated files).
  • ESLint and Prettier are clean.
  • The pre-commit hooks passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA

Closes #493. **Why:** rooms that post nothing but links, like World News RSS, fill the timeline with preview cards. The only fix was turning link previews off in every room. **What:** Room settings → General → **Display** → **Show link previews**. - It affects only this room, and only the person who sets it. - It's saved as the standard `org.matrix.room.preview_urls` room account data (`{ "disable": true }`). That's the same event Element reads, so the choice syncs across devices and also applies in Element. - The room's choice wins over the global switches. If a room has no choice, the global setting applies as before (the encrypted-room switch for encrypted rooms). - When a room has a choice saved, a **Use global setting** button saves `{}` to go back to following the global setting. - Applies to the room timeline and to threads in that room. Links stay clickable; only the preview cards are hidden. **Files:** - `utils/roomUrlPreview.ts`: pure resolver, with tests. - `hooks/useRoomUrlPreview.ts`: live hook that updates when the account data changes on any device. - `room-settings/general/RoomLinkPreviews.tsx`: the switch. It shows the new value right away and reverts if saving fails. - `RoomTimeline` and `ThreadTimeline` now use the hook. **Checks:** - `npm test`: 1480 pass, 0 fail (4 new). - `tsc`: no new errors (the same 5 baseline errors in unrelated files). - ESLint and Prettier are clean. - The pre-commit hooks passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
jared added 1 commit 2026-11-25 12:43:24 -05:00
feat(room): per-room "Show link previews" toggle (#493)
CI / Build & Quality Checks (push) Skipped
CI / Secret scan (gitleaks) (push) Skipped
CI / Playwright smoke (e2e) (push) Skipped
CI / Secret scan (gitleaks) (pull_request) Successful in 53s
CI / Build & Quality Checks (pull_request) Successful in 4m1s
CI / Trigger Desktop Build (pull_request) Skipped
CI / Docker image build & smoke test (pull_request) Skipped
CI / Playwright smoke (e2e) (pull_request) Successful in 17m49s
f63ec2e373
Rooms that post nothing but links (e.g. World News RSS) fill the timeline
with preview cards, and the only fix was turning previews off everywhere.

Room settings → General → Display now has "Show link previews" for that
room only, for this user only. It is saved as the standard
org.matrix.room.preview_urls room account data ({ disable }), the same
event Element reads, so it syncs across devices and works in Element.
The room's choice wins over the global setting; "Use global setting"
saves {} to go back. Room timeline and threads both follow it.

Closes #493

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
jared scheduled this pull request to auto merge when all checks succeed 2026-11-25 12:44:45 -05:00
jared merged commit acb0d92288 into lotus 2026-11-25 13:05:21 -05:00
jared deleted branch feat/room-link-previews-493 2026-11-25 13:05:27 -05:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#494