fix: ensure attachment is always an array for Mastodon compatibility

Fedify's JSON-LD compaction collapses single-element arrays to plain
objects. Mastodon checks `attachment.is_a?(Array)` and silently skips
non-array values, causing profile links to never display.

Also adds profile links section to the my-profile admin page and
fixes rel=me on the public profile page for bidirectional verification.
This commit is contained in:
Ricardo
2026-02-24 11:39:42 +01:00
parent 4e159bfb9d
commit df5ccc397e
5 changed files with 66 additions and 2 deletions

View File

@@ -26,6 +26,23 @@
{% if profile.summary %}
<div class="ap-my-profile__bio">{{ profile.summary | safe }}</div>
{% endif %}
{% if profile.attachments and profile.attachments.length > 0 %}
<dl class="ap-my-profile__fields">
{% for field in profile.attachments %}
<div class="ap-my-profile__field">
<dt class="ap-my-profile__field-name">{{ field.name }}</dt>
<dd class="ap-my-profile__field-value">
{% if field.value and (field.value.startsWith("http://") or field.value.startsWith("https://")) %}
<a href="{{ field.value }}" rel="me noopener" target="_blank">{{ field.value | replace("https://", "") | replace("http://", "") }}</a>
{% else %}
{{ field.value }}
{% endif %}
</dd>
</div>
{% endfor %}
</dl>
{% endif %}
</div>
<div class="ap-my-profile__stats">

View File

@@ -480,7 +480,7 @@
<dt class="ap-pub__field-name">{{ field.name }}</dt>
<dd class="ap-pub__field-value">
{% if field.value and (field.value.startsWith("http://") or field.value.startsWith("https://")) %}
<a href="{{ field.value }}" rel="noopener nofollow" target="_blank">{{ field.value | replace("https://", "") | replace("http://", "") }}</a>
<a href="{{ field.value }}" rel="me noopener" target="_blank">{{ field.value | replace("https://", "") | replace("http://", "") }}</a>
{% else %}
{{ field.value }}
{% endif %}