Skip to content

Commit 91397d4

Browse files
committed
Merge branch 'fix/public-graph-avatars' into preview/public-profiles
2 parents fe9aec6 + 1c42819 commit 91397d4

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

web/src/routes/public-profile.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,18 +653,24 @@ function RelationshipsSection({ view }: { view: PublicRelationshipsView }) {
653653

654654
// The nodes come out of the relationships themselves: every published
655655
// relationship names both of its ends, so the graph stands up on its own
656-
// even when the view serves no member list at all. Colour is the one thing
657-
// the relationship payload can't say, so it is joined from the roster when
658-
// there is one, and left neutral when there isn't.
656+
// even when the view serves no member list at all. Colour and avatar are
657+
// the two things the relationship payload can't say, so they are joined
658+
// from the roster when there is one, and left neutral when there isn't.
659+
// Avatars pass isPublicImageAllowed like every other image on this page,
660+
// even though the roster payload only ever carries same-origin URLs.
659661
const nodes = useMemo<GraphNode[]>(() => {
660662
const seen = new Map<string, GraphNode>();
661663
for (const r of relationships) {
662664
for (const end of [r.source, r.target]) {
663665
if (!seen.has(end.id)) {
666+
const card = nav?.card(end.id);
667+
const avatar = card?.avatar_url;
664668
seen.set(end.id, {
665669
id: end.id,
666670
name: end.name,
667-
color: nav?.card(end.id)?.color ?? null,
671+
color: card?.color ?? null,
672+
avatar_url:
673+
avatar && isPublicImageAllowed(avatar) ? avatar : null,
668674
});
669675
}
670676
}

0 commit comments

Comments
 (0)