Skip to content

fix/mobile PMs#154

Merged
matheusfillipe merged 5 commits into
mainfrom
fix/mobile-PMs
Mar 9, 2026
Merged

fix/mobile PMs#154
matheusfillipe merged 5 commits into
mainfrom
fix/mobile-PMs

Conversation

@matheusfillipe
Copy link
Copy Markdown
Contributor

@matheusfillipe matheusfillipe commented Mar 9, 2026

  • fix issues with PMs in mobile

Summary by CodeRabbit

  • Bug Fixes

    • Fixed user profile modal toggle so it opens/closes correctly.
    • Search close behavior improved to reliably dismiss on-screen keyboard on affected devices.
    • Mobile navigation now returns to chat view when appropriate after switching selections.
  • Improvements

    • Member list shown only for server channels, not direct messages.
    • Reply handling made more robust to avoid errors when reply state is absent.
    • Reply action restricted to standard message types.
  • New Features

    • Added Android and iOS build scripts; package version bumped.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

Bumps package to 0.2.5 and adds mobile build scripts; clamps and syncs mobile column state when member page is absent; optional-chains reply IDs in message sending; allows navigation when re-selecting chat in narrow view; blurs active element when closing empty search; gates reply actions by message.type === "message".

Changes

Cohort / File(s) Summary
Package / Scripts
package.json
Bump version 0.2.4 → 0.2.5; add npm scripts android:build, android:release, ios:build.
Layout & Mobile Navigation
src/components/layout/AppLayout.tsx
Add hasMemberPage and effectiveMobileColumn; clamp mobile column when member page absent; recompute page indexes and persist corrected column to store.
Chat Header / Keyboard Handling
src/components/layout/ChatHeader.tsx
When closing search with no query, blur active element (iOS WKWebView keyboard) before collapsing search overlay.
Message Sending Safety
src/hooks/useMessageSending.ts
Replace localReplyTo.msgid with localReplyTo?.msgid in prefix construction to avoid null access.
Store / UI State
src/store/index.ts
When selecting an already-selected channel/private chat with navigate requested in narrow view, navigate to chat view; fix profile modal toggle to control isUserProfileModalOpen.
Message Reply Gating & Actions
src/components/message/MessageItem.tsx, src/components/message/MessageActions.tsx
Change reply gating to use message.type === "message"; add canReply?: boolean prop to MessageActions with default canReply = !!message.msgid, and use it to conditionally render Reply and React actions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ValwareIRC

Poem

🐇 I nibble lines and hop between,
I clamp the columns, keep views clean.
Optional IDs, safe and bright,
A blur to hush the webview's light.
Build scripts ready — small delight.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix/mobile PMs' directly relates to the main objective of fixing private message handling on mobile platforms, which is demonstrated throughout the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/mobile-PMs

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 and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 9, 2026

Pages Preview
Preview URL: https://fix-mobile-pms.obsidianirc.pages.dev

Automated deployment preview for the PR in the Cloudflare Pages.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/layout/AppLayout.tsx`:
- Around line 124-133: currentPageIndex can momentarily point past the available
pages when hasMemberPage flips false, causing a blank swipe page; clamp or
recompute it against the current totalPages instead of relying solely on
getPageIndex(mobileViewActiveColumn). Replace the plain assignment to
currentPageIndex with a safe value (e.g., let totalPages = hasMemberPage ? 3 :
2; const currentPageIndex = Math.min(getPageIndex(mobileViewActiveColumn),
totalPages - 1)) so the index never exceeds available pages, and apply the same
clamped logic to the other occurrence that uses
getPageIndex/mobileViewActiveColumn (the block around the second instance noted
in the review).

In `@src/hooks/useMessageSending.ts`:
- Around line 438-439: Stop generating a UUID into msgid for optimistic local
PMs: leave msgid undefined until the server returns the real IRC message ID (use
the existing id for local identity/optimistic dedupe), and if you need a
separate client-only correlation identifier introduce a new field (e.g.,
clientMsgId) instead of reusing msgid; update any codepaths that serialize
localReplyTo.msgid into reply tags (references to localReplyTo.msgid) to only
emit server-provided msgid, and if you want the client-only id to participate in
dedupe add it to processedMessageIds logic rather than overwriting msgid.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2afcba6a-9576-4cc2-8631-86ccddea62f5

📥 Commits

Reviewing files that changed from the base of the PR and between 978e632 and 38250d7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • package.json
  • src/components/layout/AppLayout.tsx
  • src/hooks/useMessageSending.ts
  • src/store/index.ts

Comment thread src/components/layout/AppLayout.tsx Outdated
Comment thread src/hooks/useMessageSending.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/message/MessageItem.tsx (1)

893-900: ⚠️ Potential issue | 🟠 Major

Don't enable mobile reply on messages that lack a server msgid.

Message.msgid is optional, and the PM send path now creates optimistic local messages without one in src/hooks/useMessageSending.ts Lines 437-448. Since every send path only serializes @+draft/reply when localReplyTo?.msgid exists in src/hooks/useMessageSending.ts Lines 205-207, 308-310, and 376-377, this swipe affordance accepts replies that cannot be represented on the wire.

🛠️ Minimal fix
-        canReply={message.type === "message"}
+        canReply={message.type === "message" && !!message.msgid}
If local-only replies are intentional, they need a separate client-side flow instead of reusing the protocol reply action.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/message/MessageItem.tsx` around lines 893 - 900, The swipe
reply is being enabled for optimistic/local messages that lack a server
Message.msgid, causing replies that cannot be serialized/represented on the
wire; update the SwipeableMessage usage so reply is only enabled for messages
with a server id (e.g., change canReply to message.type === "message" &&
!!message.msgid) and also guard the onReply handler (setReplyTo) to no-op unless
message.msgid exists, referencing SwipeableMessage, setReplyTo, onReply, and
Message.msgid (see useMessageSending.ts where localReplyTo?.msgid is checked).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/message/MessageItem.tsx`:
- Around line 893-900: The swipe reply is being enabled for optimistic/local
messages that lack a server Message.msgid, causing replies that cannot be
serialized/represented on the wire; update the SwipeableMessage usage so reply
is only enabled for messages with a server id (e.g., change canReply to
message.type === "message" && !!message.msgid) and also guard the onReply
handler (setReplyTo) to no-op unless message.msgid exists, referencing
SwipeableMessage, setReplyTo, onReply, and Message.msgid (see
useMessageSending.ts where localReplyTo?.msgid is checked).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a1a4f8c4-6201-44ed-bccc-cd05b18b9b8f

📥 Commits

Reviewing files that changed from the base of the PR and between 0ae2f6f and 37ceade.

⛔ Files ignored due to path filters (3)
  • src-tauri/gen/apple/ObsidianIRC.xcodeproj/project.pbxproj is excluded by !**/gen/**
  • src-tauri/gen/apple/ObsidianIRC_iOS/Info.plist is excluded by !**/gen/**
  • src-tauri/gen/apple/ObsidianIRC_iOS/ObsidianIRC_iOS.entitlements is excluded by !**/gen/**
📒 Files selected for processing (4)
  • package.json
  • src/components/layout/AppLayout.tsx
  • src/components/message/MessageItem.tsx
  • src/hooks/useMessageSending.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/message/MessageActions.tsx (1)

11-20: Consider aligning WhisperMessage.tsx with the new canReply semantics.

The new canReply prop is a good addition for explicit control. However, there's a semantic inconsistency:

  • MessageItem.tsx now passes canReply={message.type === "message"} (type-based gating)
  • WhisperMessage.tsx (see context snippet at lines 168-187) does not pass canReply, so it falls back to the default !!message.msgid (msgid-based gating)

This means whisper messages use different reply-gating logic than regular messages. If the intent is to uniformly gate replies by message type, WhisperMessage.tsx should also pass canReply={message.type === "message"}.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/message/MessageActions.tsx` around lines 11 - 20,
WhisperMessage.tsx currently relies on MessageActions' default canReply (based
on message.msgid), creating inconsistent reply gating versus MessageItem.tsx
which passes canReply={message.type === "message"}; update the JSX in
WhisperMessage.tsx where <MessageActions ... /> is rendered to explicitly pass
canReply={message.type === "message"} (and remove reliance on the default) so
both WhisperMessage and MessageItem use the same type-based reply gating logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/message/MessageActions.tsx`:
- Around line 11-20: WhisperMessage.tsx currently relies on MessageActions'
default canReply (based on message.msgid), creating inconsistent reply gating
versus MessageItem.tsx which passes canReply={message.type === "message"};
update the JSX in WhisperMessage.tsx where <MessageActions ... /> is rendered to
explicitly pass canReply={message.type === "message"} (and remove reliance on
the default) so both WhisperMessage and MessageItem use the same type-based
reply gating logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58215a41-3b1c-479c-a26c-e171392503df

📥 Commits

Reviewing files that changed from the base of the PR and between 37ceade and b2593e7.

📒 Files selected for processing (2)
  • src/components/message/MessageActions.tsx
  • src/components/message/MessageItem.tsx

@matheusfillipe matheusfillipe merged commit 29b9ef0 into main Mar 9, 2026
4 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 9, 2026
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