From a9588065b208fbda9f6d239658b657e79c151534 Mon Sep 17 00:00:00 2001
From: Matt Jankowski <matt@jankowski.online>
Date: Tue, 3 Oct 2023 11:01:45 -0400
Subject: [PATCH] Dont match mention in url query string (#25656)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
---
 .rubocop_todo.yml           | 4 ----
 app/models/account.rb       | 2 +-
 spec/models/account_spec.rb | 2 +-
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index adfd47689..631b9b566 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -289,10 +289,6 @@ RSpec/MultipleMemoizedHelpers:
 RSpec/NestedGroups:
   Max: 6
 
-RSpec/PendingWithoutReason:
-  Exclude:
-    - 'spec/models/account_spec.rb'
-
 # This cop supports unsafe autocorrection (--autocorrect-all).
 Rails/ApplicationController:
   Exclude:
diff --git a/app/models/account.rb b/app/models/account.rb
index cdb701edb..a25ebc4aa 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -66,7 +66,7 @@ class Account < ApplicationRecord
   BACKGROUND_REFRESH_INTERVAL = 1.week.freeze
 
   USERNAME_RE   = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i
-  MENTION_RE    = %r{(?<=^|[^/[:word:]])@((#{USERNAME_RE})(?:@[[:word:].-]+[[:word:]]+)?)}i
+  MENTION_RE    = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@[[:word:].-]+[[:word:]]+)?)}i
   URL_PREFIX_RE = %r{\Ahttp(s?)://[^/]+}
   USERNAME_ONLY_RE = /\A#{USERNAME_RE}\z/i
 
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index cf593349a..fc7a43110 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -700,7 +700,7 @@ RSpec.describe Account do
       expect(subject.match('Check this out https://medium.com/@alice/some-article#.abcdef123')).to be_nil
     end
 
-    xit 'does not match URL query string' do
+    it 'does not match URL query string' do
       expect(subject.match('https://example.com/?x=@alice')).to be_nil
     end
   end