Compare commits

..

No commits in common. "kc/profileless-users-not-being-shown" and "main" have entirely different histories.

2 changed files with 13 additions and 28 deletions

View file

@ -12,14 +12,10 @@
alt="avatar of {account.displayName}" alt="avatar of {account.displayName}"
src="{Config.PDS_URL}/xrpc/com.atproto.sync.getBlob?did={account.did}&cid={account.avatarCid}" 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} {/if}
<div id="accountName">
{account.displayName || account.handle || account.did}
</div>
</div> </div>
</a> </a>
@ -32,7 +28,6 @@
padding: 0px; padding: 0px;
margin-bottom: 15px; margin-bottom: 15px;
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
min-height: 50px;
} }
#accountName { #accountName {
margin-left: 10px; margin-left: 10px;
@ -44,9 +39,6 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.no-avatar {
margin-left: 60px !important;
}
#avatar { #avatar {
width: 50px; width: 50px;
height: 50px; height: 50px;

View file

@ -132,13 +132,7 @@ const getDidsFromPDS = async (): Promise<At.Did[]> => {
const getAccountMetadata = async ( const getAccountMetadata = async (
did: `did:${string}:${string}`, did: `did:${string}:${string}`,
) => { ) => {
const account: AccountMetadata = { // gonna assume self exists in the app.bsky.actor.profile
did: did,
handle: "", // Guaranteed to be filled out later
displayName: "",
avatarCid: null,
};
try { try {
const { data } = await rpc.get("com.atproto.repo.getRecord", { const { data } = await rpc.get("com.atproto.repo.getRecord", {
params: { params: {
@ -148,22 +142,21 @@ const getAccountMetadata = async (
}, },
}); });
const value = data.value as AppBskyActorProfile.Record; const value = data.value as AppBskyActorProfile.Record;
account.displayName = value.displayName || ""; const handle = await blueskyHandleFromDid(did);
const account: AccountMetadata = {
did: did,
handle: handle,
displayName: value.displayName || "",
avatarCid: null,
};
if (value.avatar) { if (value.avatar) {
account.avatarCid = value.avatar.ref["$link"]; account.avatarCid = value.avatar.ref["$link"];
} }
return account;
} catch (e) { } catch (e) {
console.warn(`Error fetching profile for ${did}:`, e); console.error(`Error fetching metadata for ${did}:`, e);
}
try {
account.handle = await blueskyHandleFromDid(did);
} catch (e) {
console.error(`Error fetching handle for ${did}:`, e);
return null; return null;
} }
return account;
}; };
const getAllMetadataFromPds = async (): Promise<AccountMetadata[]> => { const getAllMetadataFromPds = async (): Promise<AccountMetadata[]> => {