<h3 dir="auto">Description</h3>
<p dir="auto"><span class="issue-keyword tooltipped tooltipped-se" aria-label="This pull request closes issue #6614.">Fixes</span> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3721658272" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/6614" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/6614/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/6614">#6614</a>.</p>
<p dir="auto">This PR updates the <code class="notranslate">RichText#linkify_users</code> method to support user mentions containing spaces by allowing quoted syntax (e.g., <code class="notranslate">@"Open Mapper"</code>).</p>
<p dir="auto"><strong>Key changes:</strong></p>
<ul dir="auto">
<li><strong>Updated Regex:</strong> Now detects mentions enclosed in quotes.</li>
<li><strong>Quote Handling:</strong> Supports straight quotes (<code class="notranslate">"</code>), smart quotes (<code class="notranslate">“”</code>), and escaped entities (<code class="notranslate">&quot;</code>), ensuring compatibility with the Markdown renderer.</li>
<li><strong>Email Protection:</strong> Added a negative lookbehind <code class="notranslate">(?<!\w)</code> to ensure that email addresses (e.g., <code class="notranslate">user@example.com</code>) are not accidentally parsed as mentions.</li>
<li><strong>Prevented Double-Linking:</strong> The visible <code class="notranslate">@</code> symbol is replaced with the HTML entity <code class="notranslate">&#64;</code> to prevent subsequent parsers (like <code class="notranslate">expand_link_shorthands</code>) from detecting the mention a second time.</li>
</ul>
<h3 dir="auto">How has this been tested?</h3>
<ul dir="auto">
<li><strong>New Test Case:</strong> Added <code class="notranslate">test_linkify_username_with_space</code> to <code class="notranslate">test/lib/rich_text_test.rb</code> to verify that quoted mentions are correctly parsed into relative links with safe HTML output.</li>
<li><strong>Regression Testing:</strong> Ran the full <code class="notranslate">RichTextTest</code> suite (<code class="notranslate">bundle exec rails test test/lib/rich_text_test.rb</code>) to confirm that standard mentions (<code class="notranslate">@user</code>) and email addresses still function correctly.</li>
<li><strong>Linting:</strong> Verified code style compliance using <code class="notranslate">rubocop</code>.</li>
</ul>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/6616'>https://github.com/openstreetmap/openstreetmap-website/pull/6616</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/6616/commits/dd067a0a2ba5382865f60451dd1b8957c2c00dbd" class="commit-link">dd067a0</a>  Fix issue #6614: Support spaces in @mentions using quotes</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/6616/files">2 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6616/files#diff-6854f233485e4f1bf82ed21283e3637f9114d7c5431b80926ba2f5657b54e9fb">lib/rich_text.rb</a>
    (11)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6616/files#diff-c1cefbd36a92f5d74850361751b9b01c7d326221cfa8c15c0c071008165de745">test/lib/rich_text_test.rb</a>
    (12)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/6616.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/6616.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/6616.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/6616.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6616">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLKD4SX5R23YKIC4FJL4BWBABAVCNFSM6AAAAACO75ADHKVHI2DSMVQWIX3LMV43ASLTON2WKOZTG4ZDONRQG42TGOA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLJA67B7LBKJBIWGPE34BWBABA5CNFSM6AAAAACO75ADHKWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHN4LWG6I.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/6616</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/6616",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/6616",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>