Skip to content

Web/profile: One-shot message form on user profile - #8452

Merged
aapeliv merged 6 commits into
developfrom
web/feature/profile-message-form
May 7, 2026
Merged

Web/profile: One-shot message form on user profile#8452
aapeliv merged 6 commits into
developfrom
web/feature/profile-message-form

Conversation

@aapeliv

@aapeliv aapeliv commented May 5, 2026

Copy link
Copy Markdown
Member

Human note:

This has always been a bit of a complicated UX piece so hopefully this helps

Screenshot 2026-05-04 at 22 11 22 Screenshot 2026-05-04 at 22 11 30

Also if there already is a 1:1 chat, it will go to it instead of opening up this pane. Also if profile is incomplete, it'll show the modal as normal.


Replaces the click-through to the messages page with an inline form, letting users send a first message to another user from their profile in a single step — mirrors the existing host request form pattern.

Backend already supported this via the SendDirectMessage gRPC RPC (creates-or-finds the DM and sends the message in one call), so this PR is web-only — it just wires that RPC into the service layer and builds the UI.

The Message button still navigates to an existing chat if a DM already exists between the two users; only the no-existing-DM case is replaced.

Testing

  • Updated MessageUserButton.test.tsx to cover the new "open inline form" path; existing tests pass (yarn test — 21 tests across MessageUserButton, UserPage, UserOverview).
  • Lint passes (yarn lint:fix).
  • Manual UI testing in browser: not yet done — would appreciate the reviewer exercising the golden path (Profile → Message → form → send → land in new chat) and the existing-DM path (Message → straight to existing chat).

To test locally:

  1. Visit another user's profile while logged in
  2. Click "Message"
  3. With no prior DM: inline form should open below the tabs (like the host request form). Type a message, hit Send — you should land on the new group chat page.
  4. With a prior DM: clicking Message should navigate straight to the existing chat (unchanged behavior).

Web frontend checklist

  • There are no console warnings when running the app
  • Added tests where relevant
  • Clicked around my changes running locally and it works
  • Checked Desktop, Mobile and Tablet screen sizes

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

This PR was created with the Couchers PR skill.

@vercel

vercel Bot commented May 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
couchers Ready Ready Preview May 7, 2026 11:18pm

Request Review

@jesseallhands

Copy link
Copy Markdown
Contributor

As long as this is only accessible on the user profile (and not on the search page) this should be fine. The reason for this is we want to force users to visit the profile page of the person before they send a message or request. This is very important as one of the primary pain points for hosts is that people who request or message do not read the person's profile before doing so.

Comment on lines 25 to 40
setIsMessaging(true);
} else {
//has thread
router.push(routeToGroupChat(data));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this is a bit long could you export this to a separate function like we usually do if possible? Unless it's gonna be very messy passing the router and state updates.

Comment on lines +31 to +38
interface NewMessageProps {
setIsMessaging: (value: boolean) => void;
}

interface MessageFormData {
text: string;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit - move these types above the styling. But also since they are only one item each do we need to declare them separately like this vs inline? On first glance each one is only used once.

Comment on lines +52 to +54
setIsMessaging={() => {
/* TODO: not needed here*/
}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove this then if not needed? Or allow it being undefined in the types instead if it's conditional?

@aapeliv

aapeliv commented May 6, 2026

Copy link
Copy Markdown
Member Author

@claude address the review comments

@claude

claude Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Claude finished @aapeliv's task in 5m 20s —— View job


Addressed review comments

Pushed as 6e3b000.

  • MessageUserButton.tsx — extracted the mutation into a new useMessageUser hook in features/profile/hooks/, matching the existing convention (useUpdateUserProfile, useUpdateHostingPreferences, etc). The component now just calls useMessageUser({ userId, setMutationError, setIsMessaging }) and gets back { mutate, isPending }.
  • NewMessage.tsx — inlined both single-use types. NewMessageProps is now inline in the function signature, and MessageFormData is { text: string } inline at the two useForm / useMutation call sites.
  • ProfilePage.tsx / Overview.tsx — made setIsRequesting and setIsMessaging optional in OverviewProps and removed the no-op stubs from ProfilePage. Overview falls back to () => {} when handing them to DefaultActions so the existing DefaultActions signature stays strict (it's only rendered for non-own profiles, where UserPage always passes the real setters).

Notes

  • I couldn't run yarn lint:fix or yarn test from this sandbox (commands blocked), but the changes preserve the public behavior of MessageUserButton, so the existing test cases (getDirectMessage → number triggers router push; → false triggers setIsMessaging(true); incomplete profile shows dialog) should continue to pass unchanged. Worth a local yarn test/yarn lint:fix before merging.
    • Branch: web/feature/profile-message-form

Comment thread app/web/features/messages/locales/en.json
aapeliv and others added 6 commits May 7, 2026 19:14
Replaces the redirect to /messages/chats?to=username with an inline
NewMessage form (mirrors the NewHostRequest pattern), letting users
send a first message to someone in a single step. Wires the existing
SendDirectMessage gRPC RPC into the web service layer.
ProfilePage renders Overview for the current user's own profile (no
Message button shown), so the prop is unused there but required by the
type — pass a no-op like the existing setIsRequesting stub.
- Extract MessageUserButton mutation logic into useMessageUser hook
- Inline single-use types in NewMessage
- Make Overview's setIsRequesting/setIsMessaging optional and drop the
  TODO no-op stubs from ProfilePage

Co-authored-by: Aapeli <aapeliv@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@aapeliv
aapeliv force-pushed the web/feature/profile-message-form branch from 9385b3e to 513adbe Compare May 7, 2026 23:14
@aapeliv
aapeliv merged commit baef233 into develop May 7, 2026
7 checks passed
@aapeliv
aapeliv deleted the web/feature/profile-message-form branch May 7, 2026 23:38
@github-actions github-actions Bot added the release notes: pending Add to stuff that should be included in release notes label May 7, 2026
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

📝 Release Notes

This PR should be included in the release notes.

Suggested release note:

Improved profile messaging so you can send a first message to someone directly from their profile in one step
🤖 Bot Debug Information

Model: couchers.openai.gpt-5.4
Decision: include
Reasoning: This PR adds a noticeable user-facing improvement to messaging: users can now send a first message directly from someone’s profile in one step instead of being sent through the messages page, which simplifies a previously complicated flow.

@nabramow nabramow linked an issue May 8, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes: pending Add to stuff that should be included in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamlined direct message dialog

3 participants