[openstreetmap/openstreetmap-website] feat: add social links and company to user api endpoint (PR #6452)

Pablo Brasero notifications at github.com
Fri Oct 24 09:25:27 UTC 2025


@pablobm commented on this pull request.



> +        js_links = js.dig("user", "social_links")
+        assert_equal user.social_links.count, js_links.count
+        user.social_links.each do |user_link|
+          details = user_link.parsed
+          matching_js_link = js_links.find { |js_link| 
+            js_link["url"] == details[:url] && js_link["platform"] == details[:platform] 
+          }
+          assert_not_nil matching_js_link
+        end

Alternatively, you can sort them first and avoid the nested loop:

```suggestion
        ordered_js_links = js.dig("user", "social_links").sort_by { |link| link["url"] }
        ordered_user_links = user.social_links.sort_by(&:url).map(&:parsed)

        assert_equal ordered_user_links.count, ordered_js_links.count

        ordered_user_links.zip(ordered_js_links).each do |user_link, js_link|
          assert_equal user_link[:url], js_link["url"]
          assert_equal user_link[:platform], js_link["platform"]
        end
```

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

Message ID: <openstreetmap/openstreetmap-website/pull/6452/review/3375346882 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251024/5deb2dbb/attachment.htm>


More information about the rails-dev mailing list