[openstreetmap/openstreetmap-website] Add social profile links (PR #5439)

David Tsiklauri notifications at github.com
Thu May 15 08:21:07 UTC 2025


@nertc commented on this pull request.



> +
+class SocialLink < ApplicationRecord
+  belongs_to :user
+
+  validates :url, :format => { :with => %r{\Ahttps?://.+\z}, :message => :http_parse_error }
+
+  URL_PATTERNS = {
+    :bluesky => %r{\Ahttps?://(?:www\.)?bsky\.app/profile/([a-zA-Z0-9\._-]+)},
+    :discord => %r{\Ahttps?://(?:www\.)?discord\.com/users/(\d+)},
+    :facebook => %r{\Ahttps?://(?:www\.)?facebook\.com/([a-zA-Z0-9.]+)},
+    :github => %r{\Ahttps?://(?:www\.)?github\.com/([a-zA-Z0-9_-]+)},
+    :gitlab => %r{\Ahttps?://(?:www\.)?gitlab\.com/([a-zA-Z0-9_-]+)},
+    :instagram => %r{\Ahttps?://(?:www\.)?instagram\.com/([a-zA-Z0-9._]+)},
+    :linkedin => %r{\Ahttps?://(?:www\.)?linkedin\.com/in/([a-zA-Z0-9_-]+)},
+    :line => %r{\Ahttps?://(?:www\.)?line\.me/ti/p/([a-zA-Z0-9_-]+)},
+    :mastodon => %r{\Ahttps?://(?:(?:www\.)?mastodon\.social|en\.osm\.town)/@([a-zA-Z0-9_]+)},

Parser was modified. `mastodon.social` and `en.osm.town` URLs will be parsed to be shown as `@nixCraft at mastodon.social` and `@compass at en.osm.town`.
Also, parser now supports URLs in the format `@something at somewebsite.com`. They are automatically marked as `mastodon` URLs and formatted to work as a link to `https://somewebsite.com/@something`.

Screnshots:
![image](https://github.com/user-attachments/assets/a889a35a-4bf3-4d8e-8b5a-fffa1215354e)
![image](https://github.com/user-attachments/assets/8755eaf9-adda-4a7a-b2f1-d16087c64f2b)

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

Message ID: <openstreetmap/openstreetmap-website/pull/5439/review/2842741981 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250515/c93e51b1/attachment.htm>


More information about the rails-dev mailing list