@tomhughes requested changes on this pull request.
> @@ -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
This should have `:null => false` as well I think - there's no good reason to
have a social link with no actual link.
> @@ -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",
I'm pretty sure this shouldn't have `/assets/` at the start of the link, and
that doing so may interfere with using proper hashed asset paths.
> +# 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+)},
No bluesky?
> +#
+
+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_]+)},
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.
> @@ -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>
That I18n resource doesn't exist - the resource is
`profiles.edit.social_links.remove` and is not currently exported to javascript.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5439#pullrequestreview-2619384196
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/5439/review/2619384...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev