Skip to content

feat: ai consent flow#1459

Merged
peterchinman merged 2 commits intomainfrom
peter/consent-flow
Feb 11, 2026
Merged

feat: ai consent flow#1459
peterchinman merged 2 commits intomainfrom
peter/consent-flow

Conversation

@peterchinman
Copy link
Copy Markdown
Contributor

Summary

  • Adds an AI data consent dialog on native mobile to comply with Apple guidelines. Users must accept before their first AI Chat message is sent.

Behavior:

  • Dialog only appears on native mobile (isNativeMobilePlatform())
  • Consent is persisted in the backend (User.aiDataConsent)
  • Accept → consent saved, message sends, dialog never shown again
  • Cancel → message not sent, dialog reappears on next attempt
  • Desktop/web is unaffected

Backend

  • DB migration: Adds aiDataConsent boolean column to User table
  • DB read: get_legacy_user_info returns the new field
  • DB write: patch_ai_consent() function (follows patch_user_tutorial pattern)
  • API response: GET /user/legacy_user_permissions includes aiDataConsent
  • New endpoint: PATCH /user/ai_consent to set consent

Frontend

  • Service client: getLegacyUserPermissions maps aiDataConsent; new patchAiConsent() method
  • User context: Exposes aiDataConsent accessor and useAiDataConsent() hook
  • Consent dialog: useAiDataConsentGate hook + ConsentDialog component (uses DialogWrapper/ClippedPanel pattern from ShareModal)
  • ChatInput integration: Consent gate in sendMessage() — all send paths (Enter key, touch button) flow through it

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 10, 2026

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Feb 10, 2026

Code Review

I found 1 issue that needs to be addressed:

CLAUDE.md Violation in useAiDataConsent.tsx

File: js/app/packages/core/component/AI/component/input/useAiDataConsent.tsx (line 24)

Issue: The code directly calls authServiceClient.patchAiConsent() instead of using Tanstack query, which violates the AGENTS.md rule.

Reference:

4. Going forward, all network calls to serice clients should be done through Tanstack query in the `queries` package. **DO NOT** introduce code that calls any client from `service-clients` outside of the queries package.

Fix: Follow the pattern used by other auth mutations. Create a mutation in js/app/packages/queries/auth/mutations.ts and use it in this component instead of calling the service client directly.


Otherwise, the implementation looks solid. The backend properly handles the consent persistence and the UI flow correctly gates AI message sending on native mobile platforms.

Copy link
Copy Markdown
Member

@whutchinson98 whutchinson98 left a comment

Choose a reason for hiding this comment

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

backend changes look good to me

@peterchinman peterchinman merged commit 8c68d4f into main Feb 11, 2026
38 checks passed
@peterchinman peterchinman deleted the peter/consent-flow branch February 11, 2026 15:29
@claude claude bot mentioned this pull request Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants