<p></p>
<p><b>@tomhughes</b> requested changes on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5439#discussion_r1957095020">db/migrate/20250106113207_create_social_links.rb</a>:</p>
<pre style='color:#555'>> @@ -0,0 +1,10 @@
+class CreateSocialLinks < ActiveRecord::Migration[7.2]
+ def change
+ create_table :social_links do |t|
+ t.references :user, :null => false, :foreign_key => true
+ t.string :url
</pre>
<p dir="auto">This should have <code class="notranslate">:null => false</code> as well I think - there's no good reason to have a social link with no actual link.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5439#discussion_r1957096560">app/views/social_links/_show.html.erb</a>:</p>
<pre style='color:#555'>> @@ -0,0 +1,8 @@
+<% social_links.each do |social_link| %>
+ <div class="text-body-secondary d-flex mb-3">
+ <%= image_tag "/assets/social_link_icons/#{social_link.parsed[:platform].nil? ? 'other' : social_link.parsed[:platform]}.svg",
</pre>
<p dir="auto">I'm pretty sure this shouldn't have <code class="notranslate">/assets/</code> at the start of the link, and that doing so may interfere with using proper hashed asset paths.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5439#discussion_r1957099377">app/models/social_link.rb</a>:</p>
<pre style='color:#555'>> +# 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 = {
+ :discord => %r{\Ahttps?://(?:www\.)?discord\.com/users/(\d+)},
</pre>
<p dir="auto">No bluesky?</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5439#discussion_r1957099579">app/models/social_link.rb</a>:</p>
<pre style='color:#555'>> +#
+
+class SocialLink < ApplicationRecord
+ belongs_to :user
+
+ validates :url, :format => { :with => %r{\Ahttps?://.+\z}, :message => :http_parse_error }
+
+ URL_PATTERNS = {
+ :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/@([a-zA-Z0-9_]+)},
</pre>
<p dir="auto">Once again mastodon is a problem because mastodon.social is just one option, but I'm not sure what the solution is... At the very least en.osm.town should probably be recognised though.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5439#discussion_r1957099723">app/assets/javascripts/user.js</a>:</p>
<pre style='color:#555'>> @@ -10,6 +10,35 @@ $(document).ready(function () {
var defaultHomeZoom = 12;
var map, marker, deleted_lat, deleted_lon;
+ if ($("#social_links").length) {
+ $("#add-social-link").click(function (event) {
+ event.preventDefault();
+ const newIndex = -Date.now();
+ const socialLinkForm = $(`
+ <div class="social-link-added-fields row mb-3">
+ <div class="col-sm-8">
+ <input class="form-control" type="text" name="user[social_links_attributes][${newIndex}][url]" id="user_social_links_attributes_${newIndex}_url">
+ </div>
+ <button type="button" class="btn btn-outline-primary col-sm-2 align-self-start">${I18n.t("javascripts.profiles.edit.social_links.remove")}</button>
</pre>
<p dir="auto">That I18n resource doesn't exist - the resource is <code class="notranslate">profiles.edit.social_links.remove</code> and is not currently exported to javascript.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5439#pullrequestreview-2619384196">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLLEWWDTGHEXEILYQ5L2P4TCXAVCNFSM6AAAAABUCYTSJCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMMJZGM4DIMJZGY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLI4DFD5YRUJAUGB5W32P4TCXA5CNFSM6AAAAABUCYTSJCWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTU4ECQYI.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5439/review/2619384196</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5439#pullrequestreview-2619384196",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5439#pullrequestreview-2619384196",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>