@AntonKhorev commented on this pull request.


> +    :bluesky => %r{\Ahttps?://(?:www\.)?bsky\.app/profile/([a-zA-Z0-9\._-]+)}
+  }.freeze
+
+  NO_USERNAME_PLATFORMS = %w[discord line skype slack].freeze
+
+  def parsed
+    URL_PATTERNS.each do |platform, pattern|
+      names = url.match(pattern)
+      if names
+        return {
+          :platform => platform.to_s,
+          :name => NO_USERNAME_PLATFORMS.include?(platform.to_s) ? 
platform.to_s.capitalize : names[1]
+        }
+      end
+    end
+    { :platform => nil, :name => url }

Maybe we should remove `http(s)://` from "names" of generic urls because the 
sidebar can get quite narrow and then `http(s)://` is going to be all you're 
able to see.

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

Message ID: 
<openstreetmap/openstreetmap-website/pull/5439/review/2621504...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to