Skip to content

🐛(frontend) support users without an email in the share modal - #3057

Open
sanketpatel32 wants to merge 1 commit into
suitenumerique:mainfrom
sanketpatel32:devin/2989-share-modal-null-email
Open

sanketpatel32 wants to merge 1 commit into
suitenumerique:mainfrom
sanketpatel32:devin/2989-share-modal-null-email

Conversation

@sanketpatel32

Copy link
Copy Markdown

Purpose

Fixes #2989.

The API returns email: null for users without an email (e.g. staff accounts). The share modal called user.email.toLowerCase() and crashed, and several other places assumed email was always a string.

Proposal

  • Type email as string | null in the user API types.
  • Guard the toLowerCase call in DocShareModal and DocShareAddMemberList.
  • Fall back to full_name, then email, then undefined in SearchUserRow and the collaborative cursor name.
  • Rebuild the guest userMenu so FooterActions never renders an undefined email.

External contributions

General requirements

CI requirements

  • I made sure that all existing tests are passing
  • I have signed off my commits with git commit --signoff (DCO compliance)
  • I have signed my commits with my SSH or GPG key (git commit -S) — no signing key is available in this environment; let me know if it is required and I will arrange it
  • My commit messages follow the required format: <gitmoji>(type) title description
  • I have added a changelog entry under ## [Unreleased] section (if noticeable change)

AI requirements

  • I used AI assistance to produce part or all of this contribution (Devin, on behalf of Sanket Patel)
  • I have read, reviewed, understood and can explain the code I am submitting
  • I can jump in a call or a chat to explain my work to a maintainer

The API returns email: null for users without an identity email (for
example a staff account created with createsuperuser) while the User
type declared email: string, so searching such a user crashed the
share modal on user.email.toLowerCase(). The type now reflects the
API and the call sites are null-safe.

Refs suitenumerique#2989

Signed-off-by: Sanket Patel <sanpatel323@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The frontend User.email type now permits null. User display code handles missing email and name values. Share-modal code handles missing emails during duplicate checks and invitation creation. The changelog records support for users without an email.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Suggested reviewers: antolc

Merge Risk: Minimal · up to 3d03f

This change stops the share modal from crashing for users without an email, such as staff accounts. It touches only small display and guard paths, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the share modal now supports users whose email is null. The title is specific and matches the changeset, which types User.email as string | null and guards the toLower…
Description check Passed The description states the cause (the API returns email: null for users such as staff accounts), the crash in the share modal, and a checklist of the fixes. These match the changes in the type, DocSha…
Linked Issues check Passed Issue #2989 requires that the share modal not crash for users with email: null. It proposes typing User.email as string | null and guarding both call sites. The PR does this. types.ts changes …
Out of Scope Changes check Passed All changed files relate to the null-email fix. The DocShareModal.tsx change is the one-line optional-chaining guard required by #2989. The FooterActions.tsx diff rebuilds the guest userMenu so …
Full details: Title check

Explanation

The title names the main change: the share modal now supports users whose email is null. The title is specific and matches the changeset, which types User.email as string | null and guards the toLowerCase calls in DocShareModal and DocShareAddMemberList.

Full details: Description check

Explanation

The description states the cause (the API returns email: null for users such as staff accounts), the crash in the share modal, and a checklist of the fixes. These match the changes in the type, DocShareModal, DocShareAddMemberList, SearchUserRow, and FooterActions.

Full details: Linked Issues check

Explanation

Issue #2989 requires that the share modal not crash for users with email: null. It proposes typing User.email as string | null and guarding both call sites. The PR does this. types.ts changes User.email to string | null. The head diff of DocShareModal.tsx changes the crashing call at the referenced location (around L395-397) from user.email.toLowerCase() to user.email?.toLowerCase(). The PR summary reports a matching guard in DocShareAddMemberList.tsx, where invitation creation lowercases user.email only when present, and a fallback in SearchUserRow.tsx. The issue's coding requirement is met by the reviewed code. The PR adds no automated test file in the reviewed summary. The issue does not request a test, so this does not change the verdict. I did not inspect the DocShareAddMemberList.tsx diff directly; that conclusion rests on the PR summary.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the null-email fix. The DocShareModal.tsx change is the one-line optional-chaining guard required by #2989. The FooterActions.tsx diff rebuilds the guest userMenu so email is never undefined, which the PR description lists as a planned step. BlockNoteEditor.tsx maps an empty collaboration name to undefined, which the PR description lists for the collaborative cursor name. SearchUserRow.tsx and DocShareAddMemberList.tsx apply the planned fallback and guard. types.ts and CHANGELOG.md carry the type change and changelog entry. No unrelated change was found in the reviewed evidence. The PR summary covers the remaining files; I did not read their diffs directly.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 932e751e-b82c-4149-9789-6de8ebbfcb3c
Commits

Reviewing files that changed from the base of the PR and between 5b55459 and 3d03fd4.

Files selected for processing: 7

  • CHANGELOG.md
  • src/frontend/apps/impress/src/features/auth/api/types.ts
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx
  • src/frontend/apps/impress/src/features/docs/doc-share/components/DocShareAddMemberList.tsx
  • src/frontend/apps/impress/src/features/docs/doc-share/components/DocShareModal.tsx
  • src/frontend/apps/impress/src/features/docs/doc-share/components/SearchUserRow.tsx
  • src/frontend/apps/impress/src/features/footer/components/FooterActions.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@AntoLC
AntoLC self-requested a review November 24, 2026 09:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛(Bug) Share modal crashes on a user without an email

2 participants