Skip to content

Block incomplete profiles from creating discussions#9167

Merged
kevinortiz43 merged 5 commits into
developfrom
web/bugfix/incomplete-profile-discussion-block
Jul 3, 2026
Merged

Block incomplete profiles from creating discussions#9167
kevinortiz43 merged 5 commits into
developfrom
web/bugfix/incomplete-profile-discussion-block

Conversation

@kevinortiz43

@kevinortiz43 kevinortiz43 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Prevents users with incomplete profiles from creating new discussion threads in community pages. Previously, a user who had not completed their profile could click "New post" and submit a discussion — an empty/incomplete profile appearing as author of community content. This patch intercepts the action (both the button click and the #new deep-link) and shows the ProfileIncompleteDialog instead, consistent with how other profile-gated actions (messaging, adding friends) already work.

It also adds server-side enforcement: the frontend gate alone is bypassable via a direct gRPC CreateDiscussion call, so CreateDiscussion now aborts with FAILED_PRECONDITION for incomplete profiles — mirroring the existing pattern in CreateEvent / SendDirectMessage / CreateHostRequest / SendFriendRequest / CreatePublicTrip. Fixes Couchers-org/bugs#75.

Testing

Web CI gate — GO:

  • yarn format clean (prettier + eslint --fix, no changes)
  • tsc --noEmit clean (no type errors)
  • Jest: DiscussionsListPage (5/5 pass), MessageUserButton, AddFriendButton — all pass. No new regressions; the only failures are a known pre-existing flaky baseline (MarkdownInput / Signup / EditProfilePage / PublicTripsSection / AccountForm input-timing timeouts unrelated to this change).

Backend gate:

  • make mypy clean (Success: no issues found in 454 source files)
  • uv run pytest src/tests/test_discussions.py — 23 passed, including the new test_create_discussion_incomplete_profile (incomplete-profile token → CreateDiscussionFAILED_PRECONDITION).

Manual in-browser verification:

  • Incomplete profile → click "New post" → ProfileIncompleteDialog appears with "…before you can create a discussion…" — correct.
  • Incomplete profile → navigate to #new deep-link → same dialog intercepts — correct.
  • Complete profile → click "New post" → discussion form opens normally — no regression.
  • Checked desktop and mobile viewport sizes.

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history

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

Before
image

After:
image

image

Translation note

This PR adds a single new key (complete_profile_dialog.actions.create_discussion = "create a discussion") to app/web/features/profile/locales/en.json. Per the repo's Weblate workflow this string will be picked up and translated into all languages automatically — no manual action needed for the new key itself.

However, the broader complete_profile_dialog block is currently untranslated in several locales, so the dialog renders in English for users in those languages. Affected locales include zh-Hans zh-Hant the other languages are fine @tristanlabelle — could you advise on the missing Chinese translations specifically? Happy to help coordinate if there's a preferred process for flagging these to translators. I have included a picture of how it looks in different languages

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.

Empty profiles could start discussion threads. Gate the "New post"
action behind the existing ProfileIncompleteDialog (same pattern as
events/messages/friend requests), shown when the profile is incomplete.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kevinortiz43
kevinortiz43 requested a review from nabramow as a code owner June 23, 2026 02:57
@CouchersBot

CouchersBot commented Jun 23, 2026

Copy link
Copy Markdown
Member

Mobile

Install the Dev Tool (iOS via TestFlight, iOS Simulator, or Android .apk) here.

Scan the QR with your phone camera, or tap Open in Dev Tool on the device, to open this branch in the installed Dev Tool dev client.

    iOS         Android    
    QR to open the iOS build         QR to open the Android build    
    Open in Dev Tool         Open in Dev Tool    
Deep links

iOS

couchers-devtool://expo-development-client/?url=https%3A%2F%2F89d3cbf8--ota.preview.couchershq.org%2Fios%2Fmanifest

Android

couchers-devtool://expo-development-client/?url=https%3A%2F%2F89d3cbf8--ota.preview.couchershq.org%2Fandroid%2Fmanifest

Web (Vercel)

View the Vercel web preview for this branch.

Backend

Schema Schema diff Sample emails

Other

Protos Backend coverage Web coverage

@kevinortiz43

kevinortiz43 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Here are the ones in languages that do not have a translatable version, its only these ones, I verified by clicking all options in the dropdown. @tristanlabelle

image image

@WouldYouKindly

Copy link
Copy Markdown
Contributor

@kevinortiz43 I think we need to validate this on backend as well. Let me know if you need any help with that!

@kevinortiz43

Copy link
Copy Markdown
Contributor Author

@WouldYouKindly I would like the help regarding backend testing!

@tristanlabelle

tristanlabelle commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@kevinortiz43 Missing translations are not a concern. They happen when they happen, as our volunteer translators have the time to work on them. Until then falling back to English is expected.

The frontend gate alone is bypassable via gRPC. Mirror the existing
pattern (CreateEvent/SendMessage/etc.) and abort CreateDiscussion with
FAILED_PRECONDITION for incomplete profiles, with a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kevinortiz43

Copy link
Copy Markdown
Contributor Author

@tristanlabelle sounds good!

WouldYouKindly
WouldYouKindly previously approved these changes Jun 24, 2026

@nabramow nabramow left a comment

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.

Hey just blocking this as it's not clear if anyone actually tested this yet? @WouldYouKindly before you approved did you pull the branch and test?

We've had issues with bugs being merged to prod recently and discussed it in the last meeting we really wanna get in the habit of testing (if there is any frontend at least) before approving.

@WouldYouKindly

Copy link
Copy Markdown
Contributor

@nabramow got you. I haven't tested it, no

Comment thread app/web/components/ProfileIncompleteDialog/ProfileIncompleteDialog.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Comment thread app/web/features/communities/discussions/DiscussionsListPage.tsx Outdated
Address review: replace the useEffect + profileDialogOpen state with values
derived during render, so both entry points (#new hash, New post button)
share one gate and nothing flashes while accountInfo loads. Update the test
to mock a complete profile so it exercises the form-open path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kevinortiz43

Copy link
Copy Markdown
Contributor Author

@nabramow I have fixed the issues, please let me know if it is able to be merged

@nabramow

nabramow commented Jun 30, 2026

Copy link
Copy Markdown
Member

Code looks good now, just noticed a small design thing:

Let's center the text on the buttons? On mobile view the "edit your profile now" looks a bit weird left-centered:

Screenshot 2026-06-30 at 14 27 50

Once that's sorted happy to approve.

On mobile the dialog is narrow enough that the button labels wrap; the
wrapped lines defaulted to left-aligned (e.g. "now" under "Edit your
profile"). Add textAlign center so wrapped button text stays centered.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kevinortiz43

Copy link
Copy Markdown
Contributor Author

@nabramow Yeah you are right I have centered the text in mobile

image

@nabramow nabramow left a comment

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.

This looks good to me now! Merge away!

@kevinortiz43

Copy link
Copy Markdown
Contributor Author

Need to do a follow up story for signing up for event with an incomplete profile.

@kevinortiz43
kevinortiz43 merged commit c454076 into develop Jul 3, 2026
6 checks passed
@kevinortiz43
kevinortiz43 deleted the web/bugfix/incomplete-profile-discussion-block branch July 3, 2026 14:49
@github-actions github-actions Bot added the release notes: pending Add to stuff that should be included in release notes label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📝 Release Notes

This PR should be included in the release notes.

Suggested release note:

Blocked incomplete profiles from creating community discussions and now prompt users to complete their profile first
🤖 Bot Debug Information

Model: couchers.openai.gpt-5.4
Decision: include
Reasoning: This fixes a user-facing bug and closes a loophole by preventing incomplete profiles from creating community discussions, making behavior consistent with other profile-gated actions and improving community quality.

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.

5 participants