Skip to content

fix(messages): prevent preview links from intercepting navigation - #2221

Open
RCGV1 wants to merge 2 commits into
meshtastic:mainfrom
RCGV1:codex/issue-2217-message-preview-links
Open

fix(messages): prevent preview links from intercepting navigation#2221
RCGV1 wants to merge 2 commits into
meshtastic:mainfrom
RCGV1:codex/issue-2217-message-preview-links

Conversation

@RCGV1

@RCGV1 RCGV1 commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

  • render channel and direct-message list previews as noninteractive attributed text
  • preserve inline Markdown presentation while removing URL actions and link semantics from previews
  • add regression tests for bare URLs and Markdown links

Why

Conversation rows are already NavigationLinks. Parsing the latest message as an interactive Markdown link created a nested action, so tapping a URL preview opened the web view instead of the conversation.

This keeps links interactive inside an opened conversation while reserving all taps in conversation-list previews for row navigation.

Closes #2217

Validation

  • MeshtasticTests/MessagePreviewTextTests: 2 passed
  • MeshtasticTests/NavigationStateTests: 6 passed
  • strict SwiftLint on all four changed Swift files: 0 violations
  • simulator regression: seeded a channel whose latest message was https://meshtastic.org/docs; tapping the URL preview opened the channel and did not open a web view

Summary by CodeRabbit

  • New Features
    • Improved channel and direct-message conversation previews with Markdown-aware rendering.
  • Bug Fixes
    • Prevented preview URLs/links from being interactive; links render as readable text instead.
  • Tests
    • Added tests to ensure plain URLs and Markdown links render correctly in previews.
  • Documentation
    • Updated “Live Preview” guidance to clarify that links in preview cards are not tappable and must be opened in the conversation message bubble.

Copilot AI review requested due to automatic review settings July 28, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c4b1c53-511a-416c-aecf-2770dcf2a92a

📥 Commits

Reviewing files that changed from the base of the PR and between 874b73f and b54c632.

📒 Files selected for processing (5)
  • Meshtastic/Resources/docs/index.json
  • Meshtastic/Resources/docs/markdown/user/messages.md
  • Meshtastic/Resources/docs/user/messages.html
  • Meshtastic/Views/Messages/MessagePreviewText.swift
  • docs/user/messages.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • Meshtastic/Views/Messages/MessagePreviewText.swift

📝 Walkthrough

Walkthrough

Message previews now use a shared MessagePreviewText view that parses inline Markdown and removes link interactions. Channel and direct-message rows use this renderer, with tests and documentation covering non-interactive links.

Changes

Message preview rendering

Layer / File(s) Summary
Attributed message preview renderer
Meshtastic/Views/Messages/MessagePreviewText.swift, MeshtasticTests/MessagePreviewTextTests.swift
Adds Markdown-aware attributed rendering with link attributes removed, plus tests for URL and Markdown-link previews.
Channel and contact list integration
Meshtastic/Views/Messages/ChannelList.swift, Meshtastic/Views/Messages/UserList.swift
Uses MessagePreviewText for channel and direct-message payload previews.
Preview behavior documentation
Meshtastic/Resources/docs/markdown/user/messages.md, Meshtastic/Resources/docs/user/messages.html, docs/user/messages.md, Meshtastic/Resources/docs/index.json
Documents Markdown formatting in conversation-list previews and clarifies that preview links are non-interactive.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: copilot

Poem

I’m a rabbit with messages, hopping in view,
Links lose their sparkle, as previews stay true.
Markdown labels remain neat and bright,
No webview detours interrupt the night.
Thump, thump—safe previews take flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the fix by preventing preview links from hijacking row navigation.
Description check ✅ Passed The description covers what changed, why, and validation, with the required template mostly filled out.
Linked Issues check ✅ Passed The change matches #2217 by making list previews noninteractive so a linked latest message no longer blocks opening the channel.
Out of Scope Changes check ✅ Passed The extra documentation and index updates support the preview-link fix and don't appear unrelated to the stated goals.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RCGV1 RCGV1 added the skip-docs-check Use this label to skip the automatic docs audit label Jul 28, 2026
@RCGV1
RCGV1 marked this pull request as ready for review July 28, 2026 17:05

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
Meshtastic/Views/Messages/MessagePreviewText.swift (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the required file header.

MessagePreviewText.swift starts directly with import SwiftUI; add // MARK: MessagePreviewText or a file-level copyright comment before the import.

As per coding guidelines: add // MARK: FileName or a file-level copyright comment at the top of Meshtastic/**/*.swift files.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Meshtastic/Views/Messages/MessagePreviewText.swift` at line 1, Add the
required file-level header at the top of MessagePreviewText.swift, before the
SwiftUI import, using either the // MARK: MessagePreviewText marker or the
project’s standard copyright comment.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Meshtastic/Views/Messages/MessagePreviewText.swift`:
- Around line 15-30: Update the preview/markdown formatting section in
docs/user/messages.md to state that message previews preserve markdown
formatting but disable link interaction, while opened message bubbles keep links
clickable. Keep the existing “Link Appearance” documentation focused on opened
message bubbles.

---

Nitpick comments:
In `@Meshtastic/Views/Messages/MessagePreviewText.swift`:
- Line 1: Add the required file-level header at the top of
MessagePreviewText.swift, before the SwiftUI import, using either the // MARK:
MessagePreviewText marker or the project’s standard copyright comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bfd9fe29-d7aa-4997-9c92-d4b3a38f274c

📥 Commits

Reviewing files that changed from the base of the PR and between de26cc4 and 874b73f.

📒 Files selected for processing (4)
  • Meshtastic/Views/Messages/ChannelList.swift
  • Meshtastic/Views/Messages/MessagePreviewText.swift
  • Meshtastic/Views/Messages/UserList.swift
  • MeshtasticTests/MessagePreviewTextTests.swift

Comment thread Meshtastic/Views/Messages/MessagePreviewText.swift
Copilot AI review requested due to automatic review settings July 28, 2026 17:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@RCGV1 RCGV1 removed the skip-docs-check Use this label to skip the automatic docs audit label Jul 28, 2026
@dzienisz

Copy link
Copy Markdown

Thanks!

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.

🐞 [Bug]: When the last message is link you can't open channel

3 participants