@1ec5 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_]+)},
This is very restrictive. A lot of OSM contributors have accounts in other
places, such as but not limited to [Mapstodon](https://mapstodon.space/). Sites
that accept Mastodon accounts typically accept them in one of the following
formats:
* `map...@example.net`
* `@map...@example.net`
* `https://example.net/@mapper`
There’s no way to validate a Mastodon profile URL or Mastodon address by
domain, as that would defeat the purpose of the Fediverse.
If the purpose of this regex is only to assign a Mastodon icon, that’s no big
deal. But it looks like the link in the profile only displays the local part of
the Mastodon address. This can get confusing when multiple servers have
accounts with the same name. The standard display format is
`@map...@example.com`.
> +#
+# Foreign Keys
+#
+# fk_rails_... (user_id => users.id)
+#
+
+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_-]+)},
Flickr might be a nice one to add. I’ve seen lots of examples of people using
their Flickr accounts to host photos taken during field surveys, and our forum
has special handling for Flickr photos.
> +#
+# Indexes
+#
+# index_social_links_on_user_id (user_id)
+#
+# Foreign Keys
+#
+# fk_rails_... (user_id => users.id)
+#
+
+class SocialLink < ApplicationRecord
+ belongs_to :user
+
+ validates :url, :format => { :with => %r{\Ahttps?://.+\z}, :message =>
:http_parse_error }
+
+ URL_PATTERNS = {
Some suggestions for additional sites that users might want to display on their
profiles in the same manner, in case the list isn’t strictly limited to social
media accounts:
* OSM Community Forum (though it should be automatic)
* OpenGeofiction and OpenHistoricalMap
* Wikipedia, Wikidata, Wikivoyage, and Wikimedia Commons
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5439#pullrequestreview-2683519315
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/5439/review/2683519...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev