switches username and preferred_username

This commit is contained in:
Christian Beutel
2025-06-24 17:55:59 +02:00
parent cb4f4f8125
commit 8bf8642703
39 changed files with 175 additions and 70 deletions

View File

@@ -34,8 +34,8 @@
try {
const actors: Actor[] = await searchActors(q, includeSelf);
searchItems = actors.map((a) => ({
text: a.preferred_username!,
description: `@${a.username}${a.isLocal ? "" : "@" + a.domain}`,
text: "a.username!",
description: `@${a.preferred_username}${a.isLocal ? "" : "@" + a.domain}`,
value: a,
icon: "user",
}));
@@ -50,7 +50,7 @@
}
function onClick(item: SearchItem) {
value = item.value.username ?? value;
value = item.value.preferred_username ?? value;
onclick?.(item);
searchItems = [];
@@ -70,7 +70,7 @@
<img
class="rounded-full w-8 aspect-square mr-2"
src={item.value.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${item.value.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${item.value.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
{/snippet}

View File

@@ -105,12 +105,12 @@
true,
);
return actors.map((a) => ({
text: a.preferred_username!,
description: `@${a.username}${a.isLocal ? "" : "@" + a.domain}`,
text: a.username!,
description: `@${a.preferred_username}${a.isLocal ? "" : "@" + a.domain}`,
value: a,
icon:
a.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${a.username}&backgroundType=gradientLinear`,
`https://api.dicebear.com/7.x/initials/svg?seed=${a.preferred_username}&backgroundType=gradientLinear`,
}));
} catch (e) {
console.error(e);

View File

@@ -27,7 +27,7 @@
let avatarSrc = $derived(
comment.expand?.author.icon
? comment.expand?.author.icon
: `https://api.dicebear.com/7.x/initials/svg?seed=${comment.expand?.author.username ?? ""}&backgroundType=gradientLinear`,
: `https://api.dicebear.com/7.x/initials/svg?seed=${comment.expand?.author.preferred_username ?? ""}&backgroundType=gradientLinear`,
);
let timeSince = $derived(formatTimeSince(new Date(comment.created ?? "")));

View File

@@ -66,7 +66,7 @@
<img
class="rounded-full w-5 aspect-square mx-1 inline"
src={list.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${list.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${list.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
{handleFromRecordWithIRI(list)}

View File

@@ -143,7 +143,7 @@
<img
class="rounded-full w-8 aspect-square mx-1 inline"
src={list.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${list.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${list.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
<a class="underline" href="/profile/{handleFromRecordWithIRI(list)}"

View File

@@ -157,11 +157,11 @@
<img
class="rounded-full w-8 aspect-square mr-2"
src={share.expand.actor.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${share.expand.actor.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${share.expand.actor.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
<p>
{`@${share.expand.actor.username}${share.expand.actor.isLocal ? "" : "@" + share.expand.actor.domain}`}
{`@${share.expand.actor.preferred_username}${share.expand.actor.isLocal ? "" : "@" + share.expand.actor.domain}`}
</p>
<span
class="basis-full text-sm text-center text-gray-500"

View File

@@ -18,7 +18,7 @@
const avatarSrc = notification.expand?.author.icon
? notification.expand.author.icon
: `https://api.dicebear.com/7.x/initials/svg?seed=${notification.expand?.author.username ?? ""}&backgroundType=gradientLinear`;
: `https://api.dicebear.com/7.x/initials/svg?seed=${notification.expand?.author.preferred_username ?? ""}&backgroundType=gradientLinear`;
const timeSince = formatTimeSince(new Date(notification.created ?? ""));

View File

@@ -24,7 +24,7 @@
<img
class="rounded-full w-10 aspect-square overflow-hidden"
src={actor.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${actor.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${actor.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
<div>

View File

@@ -53,7 +53,7 @@
<img
class="rounded-full w-8 aspect-square mr-2"
src={share.expand.actor.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${share.expand.actor.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${share.expand.actor.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
<p class="font-semibold text-base">
@@ -82,7 +82,7 @@
<img
class="rounded-full w-8 aspect-square mr-2"
src={subject.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${subject.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${subject.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
<p class="font-semibold">

View File

@@ -103,7 +103,7 @@
<img
class="rounded-full w-5 aspect-square mx-1 inline"
src={log.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${log.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${log.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
{handleFromRecordWithIRI(log)}

View File

@@ -189,13 +189,13 @@
<td>
<p
class="tooltip flex justify-center"
data-title="{log.expand.author.username}{log.expand.author
data-title="@{log.expand.author.preferred_username}{log.expand.author
.isLocal
? ''
: '@' + log.expand.author.domain}"
>
<a
href="/profile/@{log.expand.author.username?.toLowerCase()}{log
href="/profile/@{log.expand.author.preferred_username?.toLowerCase()}{log
.expand.author.isLocal
? ''
: '@' + log.expand.author.domain}"
@@ -203,7 +203,7 @@
<img
class="rounded-full w-7 aspect-square"
src={log.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${log.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${log.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
</a>

View File

@@ -130,10 +130,10 @@
<img
class="rounded-full w-5 aspect-square mx-1 inline"
src={trail.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
{trail.expand.author.username}{trail.expand.author.isLocal
{trail.expand.author.preferred_username}{trail.expand.author.isLocal
? ""
: "@" + trail.expand.author.domain}
</p>

View File

@@ -377,7 +377,7 @@
<img
class="rounded-full w-8 aspect-square mx-1 inline"
src={trail.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
<a class="underline" href="/profile/{handle}"

View File

@@ -99,7 +99,7 @@
<img
class="rounded-full w-5 aspect-square mx-1 inline"
src={trail.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
{handleFromRecordWithIRI(trail)}

View File

@@ -88,10 +88,10 @@
{#if trail.expand && trail.expand.author}
<div class="author-icon">
<img
title={`${trail.public ? $_("public") + " " : ""}${$_("by")} ${trail.expand.author.username}${trail.expand.author.isLocal ? "" : "@" + trail.expand.author.domain}`}
title={`${trail.public ? $_("public") + " " : ""}${$_("by")} @${trail.expand.author.preferred_username}${trail.expand.author.isLocal ? "" : "@" + trail.expand.author.domain}`}
class="rounded-full w-5 aspect-square mx-1 inline"
src={trail.expand.author.icon ||
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.username}&backgroundType=gradientLinear`}
`https://api.dicebear.com/7.x/initials/svg?seed=${trail.expand.author.preferred_username}&backgroundType=gradientLinear`}
alt="avatar"
/>
</div>