Skip to content

allowing spaces in display name#9121

Open
notHuman9504 wants to merge 1 commit into
makeplane:previewfrom
notHuman9504:fix/allowing-spaces-in-display-name
Open

allowing spaces in display name#9121
notHuman9504 wants to merge 1 commit into
makeplane:previewfrom
notHuman9504:fix/allowing-spaces-in-display-name

Conversation

@notHuman9504
Copy link
Copy Markdown

@notHuman9504 notHuman9504 commented May 23, 2026

Description

Fixes the issue #9112
We were not allowed to enter spaces in display name, changed the regex so we can now.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Screenshot 2026-05-24 at 3 22 33 AM

Test Scenarios

  • Tried Entering Spaces - It worked
  • Tried Entering other characters like * / ( $ - it stopped and gave warning.

References

(#9112)

Summary by CodeRabbit

  • Bug Fixes
    • Display names and usernames can now include space characters.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 23, 2026

📝 Walkthrough

Walkthrough

The PR updates display name validation to allow space characters. The regex pattern in DISPLAY_NAME_REGEX is modified to include spaces in the allowed character set, and the corresponding validation error message in validateDisplayName is updated to document that spaces are permitted.

Display Name Validation Update

Layer / File(s) Summary
Display name regex and validation message
packages/utils/src/validation.ts
DISPLAY_NAME_REGEX constant modified to permit spaces in display names, and validateDisplayName error message updated to state spaces are allowed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Poem

A rabbit hops through character sets,
Finding space where letters met,
Now names may breathe with rooms between,
The happiest regex ever seen! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'allowing spaces in display name' directly and clearly summarizes the main change made in this PR.
Description check ✅ Passed The description includes all key sections from the template: detailed description, type of change, screenshots, test scenarios, and references to the related issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

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 (2)
packages/utils/src/validation.ts (2)

86-95: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update JSDoc example to reflect that spaces are now allowed.

The example explicitly states that "john doe" returns an error because spaces are not allowed, but this is no longer true.

📝 Proposed fix
 /**
  * `@description` Validates display names and usernames
  * `@param` {string} displayName - Display name to validate
  * `@returns` {boolean | string} true if valid, error message if invalid
  * `@example`
  * validateDisplayName("john_doe") // returns true
  * validateDisplayName("john.doe-123") // returns true
- * validateDisplayName("john doe") // returns error message (spaces not allowed)
+ * validateDisplayName("john doe") // returns true
  * validateDisplayName("john<>doe") // returns error message
  */
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/utils/src/validation.ts` around lines 86 - 95, Update the JSDoc
examples for validateDisplayName to reflect that spaces are permitted: replace
the example showing validateDisplayName("john doe") returning an error with one
that shows it returns true (e.g., validateDisplayName("john doe") // returns
true), and ensure any other example descriptions mention spaces are allowed
rather than disallowed so the docstring matches the current validation behavior.

28-33: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update documentation comment to reflect that spaces are now allowed.

The comment explicitly states "Blocks: Spaces and injection-risk characters" but the regex now permits spaces. This inconsistency will confuse future maintainers.

📝 Proposed fix
 /**
  * Display Name Pattern (for display_name, usernames)
- * Allows: Unicode letters (\p{L}), numbers (\p{N}), underscore, period, hyphen
- * Use case: International usernames like "josé_123", "李明.dev", "müller-2024"
- * Blocks: Spaces and injection-risk characters
+ * Allows: Unicode letters (\p{L}), numbers (\p{N}), spaces, underscore, period, hyphen
+ * Use case: International usernames like "josé_123", "李明.dev", "müller-2024", "JJ KK"
+ * Blocks: Injection-risk characters
  */
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/utils/src/validation.ts` around lines 28 - 33, Update the
documentation comment for the Display Name Pattern to reflect that spaces are
allowed by the current regex (remove "Blocks: Spaces" and instead list "Allows:
spaces" or "Allows: spaces and ..." and keep mention of injection-risk
characters as still blocked); locate the comment tied to the Display Name
Pattern / display_name regex (e.g., the constant or variable used for the
display name pattern) and edit the comment text so it accurately describes
allowed characters (Unicode letters, numbers, underscore, period, hyphen, and
spaces) and what is blocked.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/utils/src/validation.ts`:
- Around line 86-95: Update the JSDoc examples for validateDisplayName to
reflect that spaces are permitted: replace the example showing
validateDisplayName("john doe") returning an error with one that shows it
returns true (e.g., validateDisplayName("john doe") // returns true), and ensure
any other example descriptions mention spaces are allowed rather than disallowed
so the docstring matches the current validation behavior.
- Around line 28-33: Update the documentation comment for the Display Name
Pattern to reflect that spaces are allowed by the current regex (remove "Blocks:
Spaces" and instead list "Allows: spaces" or "Allows: spaces and ..." and keep
mention of injection-risk characters as still blocked); locate the comment tied
to the Display Name Pattern / display_name regex (e.g., the constant or variable
used for the display name pattern) and edit the comment text so it accurately
describes allowed characters (Unicode letters, numbers, underscore, period,
hyphen, and spaces) and what is blocked.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 74377212-6ac5-44df-b1ff-18b234b0bff7

📥 Commits

Reviewing files that changed from the base of the PR and between 039d582 and d5ea2fc.

📒 Files selected for processing (1)
  • packages/utils/src/validation.ts

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.

1 participant