@hlfan requested changes on this pull request.


> @@ -97,6 +98,16 @@ def linkify(text, mode = :urls)
 
     private
 
+    def linkify_users(text)
+      text.gsub(/(?<!\w)@(?:(?:&quot;|["“”])(.+?)(?:&quot;|["“”])|(\w+))/) do 
|match|
+        name = ::Regexp.last_match(1) || ::Regexp.last_match(2)
+        slug = ERB::Util.url_encode(name)
+        safe_match = match.sub("@", "&#64;")
+
+        "<a href=\"/user/#{slug}\" rel=\"nofollow noopener 
noreferrer\">#{safe_match}</a>"

This should go through `Rinku.auto_link` as well to keep it DRY

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6616#pullrequestreview-3576277773
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/6616/review/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to