Skip to content

TAN-7561 User search with special letters + refactoring#13699

Open
sebastienhoorens wants to merge 4 commits intomasterfrom
TAN-7561-user-search-special-chars
Open

TAN-7561 User search with special letters + refactoring#13699
sebastienhoorens wants to merge 4 commits intomasterfrom
TAN-7561-user-search-special-chars

Conversation

@sebastienhoorens
Copy link
Copy Markdown
Contributor

Changelog

Fixed

  • [TAN-7561] Searching users with special character letters (for example "Jørgen").

sebastienhoorens and others added 4 commits April 23, 2026 15:34
The previous regex (\W) stripped non-ASCII characters like ø, é, ñ from
mention search queries, breaking user search for names with special
characters. Replace with \p{L} to preserve Unicode letters, apostrophes,
hyphens, and spaces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move user search logic out of the mentions controller and mention
service into a dedicated UserSearchService. This consolidates query
sanitization, idea participant prioritization, and role filtering
into a single service with a clean interface.

- Replace roles[] param with moderators_only boolean (simpler API)
- Use admin_or_moderator scope (covers folder/space moderators too)
- Reuse ParticipantsService for idea participant lookup
- Apply .active scope consistently across both search tiers
- Add comprehensive service spec (Unicode, idea context, moderators)
- Simplify controller from 58 to 21 lines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The gsub was a leftover from a 2020 slug-to-pg_search migration.
pg_search already sanitizes tsquery special characters internally
via DISALLOWED_TSQUERY_CHARACTERS, so the extra sanitization was
redundant. Added a spec to confirm special characters are handled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@notion-workspace
Copy link
Copy Markdown

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