Fix users with no profile record not being shown #7
2 changed files with 28 additions and 13 deletions
|
@ -12,10 +12,14 @@
|
|||
alt="avatar of {account.displayName}"
|
||||
src="{Config.PDS_URL}/xrpc/com.atproto.sync.getBlob?did={account.did}&cid={account.avatarCid}"
|
||||
/>
|
||||
<div id="accountName">
|
||||
{account.displayName || account.handle || account.did}
|
||||
</div>
|
||||
{:else}
|
||||
<div id="accountName" class="no-avatar">
|
||||
{account.displayName || account.handle || account.did}
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
<div id="accountName">
|
||||
{account.displayName || account.handle || account.did}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
|
@ -28,6 +32,7 @@
|
|||
padding: 0px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid var(--border-color);
|
||||
min-height: 50px;
|
||||
}
|
||||
#accountName {
|
||||
margin-left: 10px;
|
||||
|
@ -39,6 +44,9 @@
|
|||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.no-avatar {
|
||||
margin-left: 60px !important;
|
||||
}
|
||||
#avatar {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
|
|
|
@ -132,7 +132,13 @@ const getDidsFromPDS = async (): Promise<At.Did[]> => {
|
|||
const getAccountMetadata = async (
|
||||
did: `did:${string}:${string}`,
|
||||
) => {
|
||||
// gonna assume self exists in the app.bsky.actor.profile
|
||||
const account: AccountMetadata = {
|
||||
kc marked this conversation as resolved
Outdated
astra
commented
Is this comment still valid? Is this comment still valid?
kc
commented
No, not really. I forgot to remove it, sorry! No, not really. I forgot to remove it, sorry!
I'll clean up some things a bit now
|
||||
did: did,
|
||||
handle: "", // Guaranteed to be filled out later
|
||||
displayName: "",
|
||||
avatarCid: null,
|
||||
};
|
||||
|
||||
try {
|
||||
const { data } = await rpc.get("com.atproto.repo.getRecord", {
|
||||
params: {
|
||||
|
@ -142,21 +148,22 @@ const getAccountMetadata = async (
|
|||
},
|
||||
});
|
||||
const value = data.value as AppBskyActorProfile.Record;
|
||||
const handle = await blueskyHandleFromDid(did);
|
||||
const account: AccountMetadata = {
|
||||
did: did,
|
||||
handle: handle,
|
||||
displayName: value.displayName || "",
|
||||
avatarCid: null,
|
||||
};
|
||||
account.displayName = value.displayName || "";
|
||||
if (value.avatar) {
|
||||
account.avatarCid = value.avatar.ref["$link"];
|
||||
}
|
||||
return account;
|
||||
} catch (e) {
|
||||
console.error(`Error fetching metadata for ${did}:`, e);
|
||||
console.warn(`Error fetching profile for ${did}:`, e);
|
||||
}
|
||||
|
||||
try {
|
||||
account.handle = await blueskyHandleFromDid(did);
|
||||
} catch (e) {
|
||||
console.error(`Error fetching handle for ${did}:`, e);
|
||||
return null;
|
||||
}
|
||||
|
||||
return account;
|
||||
};
|
||||
|
||||
const getAllMetadataFromPds = async (): Promise<AccountMetadata[]> => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue
Idk about the styling change, needs a further discussion (prolly as part of a bigger config update)
In the chat you said that it'd be better to not align avatarless users and keep them small, should I do that now?